Another Firefox relative path conundrum - html

Ok.
So I know this is probably a stupid question, but I've been traversing SO and Google for the last many hours for an answer and found nothing.
I'm currently creating a HTML5 mobile app using JQM 1.2.0 and Google Maps js V3 - just to set the context.
My problem occurs when I try to test the page in FF 18 desktop version. In every other browser, be it mobile or desktop, I'm not having any problems. Also, I have tried on both localhost as well as the server I'm deploying to, and it's the same result.
In my HTML file I have a relative link to css and js files:
<script src="js/general.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/mobile.css"/>
while my links to JQM etc. are absolute as I use a CDN:
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
When I use Firebug, I can see that the files with a absolute path are loaded fine, while the relative path links are ignored - or at least I think so, as nothing shows up in neither the Console or the Net pane.
When I check the Html pane in Firebug, it appears as if it has included a tag pr default (with the correct URL), but not if I try to view page source using the regular FF methods. Even though, I have tried to include a explicit base tag to my header and it changes nothing.
So, to sum up: relative path works fine in all browsers except FF, it it happens on both my server and localhost.
Update:
Tried moving the files to the root dir, but it didn't help.
Also, when trying to view the content of the js or css file in Firebug (pressing the arrow to the left of the tag in index.html), it just says:
Reload the page to get source for: http://localhost/~u040800/app/general.js
which, of course does not change after reload.

Nevermind - stupid mistake on my side!!
Note to self: when developing, do make sure that your add-ons are disabled before asking SO! otherwise, you make a complete ass of yourself!!
Yes, it is correct - I forgot to disable Ad-Blocker...
#robertc: Sorry to have wasted your time.

Related

favicon.ico 404 (Not Found)

Chrome - source code tab - I see the following in console:
GET http://localhost/favicon.ico 404 (Not Found)
Inside head tag I have the following:
<link href='ico/favicon.ico' rel='icon'>
Click on the above link - opens a new tab with the ico image.
Also tried - without succes:
<link rel="shortcut icon" href="ico/favicon.ico">
Click on the above link says- doesn't exists.
Also I noticed the error message appears only at start and after pressing Ctrl F5, and after pressing F5 only - it dissapears.
Anyway, there is no icon on the browser's tab in any case.
On page tab - console is empty.
Other browsers not tested.
So what is the right way to have an icon and how to avoid the above message?
I've had problems like this with web servers running Linux. Sometimes you need to set the execute bit on the favicon.ico file:
chmod +rx favicon.ico
I've also had to give permissions to the web server service/account to the file:
sudo chown www-data:www-data /var/www/favicon.ico
Make sure your favicon does exist by going to http://localhost/ico/favicon.ico
and then try ctrl + f5, sometimes caching can ruin things up.
TL; DR
Things you should try:
Test with Firefox. If that works, you probably have a body-only markup in your head.
Use an absolute path (ie. /ico/favicon.ico)
Explanations
Browsers try to get favicon.ico in the root directory by convention. So this line in the dev console does not mean your browser doesn't understand ico/favicon.ico. This is more a sign that the favicon markup didn't work for any reason, so your browser is using the "root folder convention" as a fallback.
Using an absolute path (ie. /ico/favicon.ico instead of ico/favicon.ico) might help you pinpoint the issue, especially if your test page is not /.
Chrome has a particular behavior regarding forbidden markups in head (eg. div, p... which are body-only markups). When this happens, it considers the head section to be closed and thus ignores all head-only markups... such as link. Consequence: favicon sometimes works everywhere but fails on Chrome. So this is a good idea to test on another browser. It the favicon works elsewhere, look carefully at your head and try to spot a markup that shouldn't be here. W3C validator might help.
As Philippe said check that you don't have any wrong in your head tag. In my case I was printing a value with an echo function (php code). Removing it resolves this issue.
I was using tailwind and encountered the above error, I simply fixed it by
going back to my public folder and deleted the index.html page and recreated it back then paste
<link href="https://unpkg.com/tailwindcss#^1.0/dist/tailwind.min.css"rel="stylesheet"/>
in the head section and it was fixed.

CSS DROPDOWN MENU not working from WEBsite but OK on developer machine [duplicate]

I downloaded the barebone example of Twitter's bootstrap and customized it. I tested it locally (with WAMP server) and everything works perfectly, both the CSS and the JScript.
I uploaded the files to my webhosting service and the JScript just doesn't work. I noticed it because dropdown boxes stopped working.
I searched and found other persons with the same problem but they all are using ruby and I'm not. Just the play CSS+JScript provided by bootstrap. Besides they said the solution was to include the bootstrap.js first and then the jquery.js. Well I tried it and it didn't work, I even included the not minified .js and still it didn't work.
I'm using the same browser (Chrome) for local and remote testing. I also tried different hosting services and the problem occurred in both.
Help is much appreciated.
Other similar questions:
Javascript features work on localhost but not when deployed to Heroku
twitter bootstrap drop down suddenly not working
The issue might be that you load boostrap.js before jQuery. Locally your browser may be using a cached copy of Jquery, so it works there but not on your live site. Try fixing it by switching those two lines in your code:
<script src="/code4pt/styles/js/bootstrap.js"></script>
<script src="/code4pt/styles/js/jquery.js"></script>
I know this is very strange but I think I got the solution. Previously I was using the (supplied) jQuery 1.7.2 minified. Now I changed it to use the jQuery 1.8.0 not minified. It just started to work... Another thing I did was to convert all files' encoding to UTF8 (I think this was the real problem/solution)
I had the same problem. In IE, the site was working on localhost but not when hosted on a different server. Adding the following meta tag fixed it.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
I had the exact same problem, so was relieved to find this post and others like it. My resolution was similar. I pulled my hair out for half a day trying all different things. Walked the dog. Had half a dozen beers. Slept on it. Had breakfast. Recopied back the stylesheets at top, and the js from the bottom from the local html to the server php, and then for some unknown reason it started working again. The only points which seem useful for others going through the same:
Try and get back to a working scenario - in my case the index.html was working on the server but not the index.php. Getting these the exact same was key.
Try on different browsers just in case something strange is going on.
Make sure you keep clearing the browser cache (e.g. right click on the reload button in Chrome and choose 'Empty Cache and Hard Reload')
Inspect your bootstrap css and js versions. Change them forward and backward in version until you get success. Chances are, the version that came with your bootstrap theme download is the most likely one to work.
I was having simular issues before. The tabs function was working fine in my HTML site, but would not work when coded into a Wordpress theme. All of the source URLS were being generated dynamically with Wordpress's .
The tabs finally began working when I added all JS links (except for Modernizr into the footer instead of the header.
Back to basics: If Debug is set to true on the local machine and false on the deployment environment as it should be, make sure your .min.js files are not overriding customizations you have made to the non-minified versions of .js files (applies to .css as well).
You can also turn Debug off on the local machine and you should see the same issues.
Late to the party but I found out that my issue was that the Bootstrap.js was not being pushed out during deployment.
In addition to the very useful suggestions by #dialex and #Darrell , I will add that if none of that works, you can review any code that you might be linking to, ie. via require ('page.php');, for duplicates. Duplicated .js links tend to cause these issues.
I ran into this on a site I built and uploaded to Amazon S3. Worked fine on my local machine and even my local server, but didn't work when served from Amazon. The console in Firefox (but not Chrome) showed it was failing to load bootstrap.min.css (et. al) because their MIME type was not text/css.
I had to use the S3 console to force change their types to text/css, clear caches, and reload. Voila!
I'm using Codeigniter. I solve these issues by changing my base_url in config.php.
Previous :
$config['base_url'] = 'http://localhost/public_html';
Changes to :
$config['base_url'] = 'http://(my intranet server ip adress)/public_html';
Had the same problem
In my .html files I had this line
<link th:rel="stylesheet" th:href="#{/webjars/bootstrap/4.0.0-2/css/bootstrap.min.css} "/>
After changing it to this
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
Everything works fine. I guess that internally webjars have http and changing css link to start with https solved my problem

Can't find favicon in web page source

Maybe a stupid question, but for the life of me I can't find a reference to the favicon "ico" file on this website:
http://www.fitnessutah.com/
They obviously have one because it displays in the browser tab/window. I've tried Chrome developer tools, Network tab which shows all images on a page -- but no favicon there either. Where is it hiding?
It does seem to be being pulled in differently, but it is typically always in the default location - which this one is as well.
http://www.fitnessutah.com/favicon.ico
There are two ways to specify the favicon for a website:
1) Give a link to the favicon
<link rel="icon" type="image/png" href="/somepath/favicon.png" />
2) Put it in a prefefined URL, this is relative to the server root. So in this case will be http://www.fitnessutah.com/favicon.ico
This website seems to be using the second method so you will find the favicon in that link.
You do not need to add a link element with your favicon image for it to appear on your website.
Quote:
A second method for specifying a favicon relies on using a predefined URI to identify the image: "/favicon", which is relative to the server root.
Source:
http://www.w3.org/2005/10/howto-favicon
Further to Keir's and Carlos' answers - to spell it out - most browsers are programmed to also look for a favicon here:
http://yourwebsitename.com/favicon.ico
If the favicon image is named/stored as above, there is no need to mention it in the HTML code.
Therefore, if you are looking at a website and you can't find any reference to their favicon in the HTML source, just type the website's base URL in the browser address bar followed by /favicon.ico:
http://example.com/favicon.ico
Real-life example - try to find the favicon in the source code:
http://www.fuelly.com/favicon.ico
Use Chrome Dev Tools Network tab.
Filter by favicon
reload the page with Shift+F5
You will get the icon regardless it was loaded with link or from default location

Font Awesome does not work in browser, but works in codepen

I downloaded Font Awesome today and did it a try. In firefox and chrome (latest versions) it appears as blank squares. If a use the CDN link, it doesnt even work, the standard bullets appear instead of the blank squares. But in codepen.io, it just worked fine, using the CDN.
The html i used is just the same as the example of the lists, which is here: http://codepen.io/pietrofxq/pen/BCaoD
Does someone knows the problem?
You are using a schemaless URL to access the CDN.
If you are trying to open the page from your disk (schema being file://) then it will fail is it will use the same schema to access the CDN
Try with a full URL http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css
If you are calling it from a server, then make sure that the font files are delivered correctly. Some servers need to be told to allow the font files to be accessed.
(use the console to see if they load ok)

Firefox doesn't show favicon

I created favicon.ico file and declared it in my HTML head tag:
<link type="image/x-icon" href="favicon.ico" rel="icon" />
<link type="image/x-icon" href="favicon.ico" rel="shortcut icon" />
IE 8 and Opera handle it great but FireFox does not even try to load it (as I see from my Fiddler debug proxy). I've tried many different type (image/ico etc.) and href params but no luck.
What did I miss?
Like most things in the browser, favicons (or lack thereof) are common candidates for caching.
Try clearing your browser cache.
In Mozilla Firefox, the keyboard shortcut to "Reload (override cache)" is
Ctrl + F5 OR
Ctrl + Shift + R
Firefox has separate cache for favicon and this does not work properly. The favicon is not updated easily in firefox. This is a small issue but troubles many of us for long time.
The solution is to clear the favicon cache so that the favicon is update. There are many solutions you can find if you go through the internet or stackoverflow. Most of the solution imvolves deleteing the favicon cache manually or using some plugins. Some saying deleting the file from temp internet files. But there is one really simple and easy way to fix the problem.
Type in www.yoursite.com/favicon.ico (or www.yoursite.com/apple-touch-icon.png, etc.)
CTRL + F5 or CTRL + R
This will immediately update the favicon.
This solution was originally posted by 'alex' at this link:
How do I force a favicon refresh
That's strange, because I just copy/pasted your code to a blank document, opened with firefox and some random image I renamed to favicon.ico loaded up as the favicon.
Maybe try this?
http://help.godaddy.com/article/4145
My problem was that I had another favicon.ico in a web root directory.
If You have a favicon in template directory "/template/favicon.ico" and another one in "/favicon.ico" firefox will use the favicon from root direcory even though you've used a link for favicon in template folder. Solution is delete the favicon in root directory.
My current version of firefox is 58.0b6 (Quantum).
So just had an issue with favicons not showing in Firefox v70.0.1.
Now this will probably only be an issue for a very few people and most likely only if you have modified the about:config settings in FF
This issue for me was the setting privacy.resistfingerprinting was set to true on some sites this will block favicons.
The other issue I noticed and what lead me to find out what was causing the issue was using dropzone.js on a site I was creating the uploaded images had a blank preview. The previews are base64 encoded and were being blocked by this.
Like I said most likely wont be an issue for most but wanted to post this somewhere so it may help others that may be facing a similar issue as I did.
See more here: https://wiki.mozilla.org/Security/Fingerprinting
And Here: https://bugzilla.mozilla.org/show_bug.cgi?id=1452391
I am not much of a programmer but I had a similar problem and here is the simple thing that finally worked for me...
I admin several simple websites but Firefox refused to load the favicon of one in particular site. I looked online, tried everything I was able to understand. Nothing worked. The code was exactly the same (copied in fact) from the other websites whose icons worked well.
Eventually it dawned on me that maybe Firefox did not like the path I used to get there. This site was a forwarded URL being hosted on my own domain. (i.e. personal domain is myplace.ca and the favicon that would not load was part of registered URL something.com which was actually located at myplace.ca/PutItHere/) If I used the registered URL (something.com) no favicon. If I use the real path in the browser, suddenly favicon! All I had to do was bookmark the absolute path rather than the registered domain!
I also found, that if you reference the full URL path, you may need to reference the URL WITH www. in it, otherwise it may not load.
Here it's in 2017. Firefox didn't pick up my favicon called "favicon-32x32.png", while Chrome was showing. I changed the file name to "favicon.png", AND refreshed as folks showed above, it worked great. I'm using:
Firefox version 55.0
Chrome version 60.0