Image and CSS URL paths not resolving to correct locations in browser - github

When I recorded the network activity of my project on https://zeddrix.github.io/bible-query/, and looked at the path of my style.css, the path should be like this: https://zeddrix.github.io/bible-query/styles/style.css to access my CSS.
But instead of having that, I keep on having https://zeddrix.github.io/styles/style.css without the /bible-query/ that's why it can't be found.
The same happened with my images. For example, instead of having https://zeddrix.github.io/bible-query/img/play-btn.jpg, I keep on having https://zeddrix.github.io/img/play-btn.jpg without the /bible-query/ on the URL again.
I was expecting to have this (on Live Server):
But instead, I keep on having this (on GitHub Page):
Please help me. Here's my repository: https://github.com/zeddrix/bible-query

Try removing the first forward slash from all of the URL references. So, <link rel="stylesheet" href="/styles/style.css" /> would become <link rel="stylesheet" href="styles/style.css" />. This will turn it into a "relative" link, instead of an absolute link.

Related

Favicon is not visible

I can not see the favicon in any browser at https://www.example.com
I tried the following implementations:
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
and
<link rel="icon" type="image/x-icon" href="/favicon.ico">
The favicon is in root-folder.
I also checked the Chrome Debugger and it gives me a "200 status ok" for favicon.ico
I tried checking it from multiple places (Work, Home, Smartphone...) - can't see it anywhere.
I also used one of these SEO-Checking sites to check if there is a favicon.
They tell me, that there is one but when they try to show me the favicon they found, it is simply not visible - there is a browser "image not found" symbol instead.
I started implementation more than 24h ago, not sure if it's a a caching problem.
The favicon is in root-folder.
Any ideas?
If you look well, you are getting a 200 status ok on the favicon, but the type is set to html, and not img.
also if you visit https://www.appfelsine.com/favicon.ico, you get an html page and not the icon image.
Might have something to do with your .htaccess perhaps? Try storing the favicon in your images folder and change the path, see if it works
Your 404 page returns a 200 (instead of a 404), so all those SEO sites see the 200 success and assume the favicon is loaded. Your favicon is not in the correct directory. To confirm this you can open up the page source and click the link to the favicon url and see that it's returning a 404 page. I would recommending putting the favicon in the same folder as other images and linking to it there.
Might be that the image is corrupted. My suggestio is to convert it to PNG. Really likely you would have a performance gain that makes this solution worth it.
To convert it:
http://image.online-convert.com/convert-to-png
Use then:
<link rel="icon"
type="image/png"
href="/favicon.png">

Bootstrap css causing form submit to goto page top?

Using a sitefinity site (v7.1.5), we have a link ref in the masterpage to bootstrap cdn.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
We're having an issue with a form that's halfway down on the homepage. When it's submitted, the page jumps back to the top even if there's form validation errors, therefore the user assumes the form was sent since they can't see the errors unless they scroll down. I found out by trial & error that if I take out the bootstrap css link, the form stays put after submit is clicked. Can anyone explain what's causing this?
http://tinyurl.com/pxfduf4
try use this:
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
without https:
Sitefinty from all my expierience does that with or without bootstrap

Facebook Share Link not posting the right URL

I am using code found in http://www.facebook.com/share_partners.php/
It says to replace with the URL I want to share.
The page where the share icon is placed is NOT the URL I want to share. The URL I want to share I enter as
However, first it worked, but now it is pulling the meta value AND the URL from the actual page!
My concern is that it is grabbing the URL from the page, not what I input because of:
u=location.href;t=document.title
On the page (both the one with the share icon AND the actual shared page) I tried to define the preview image with:
<link rel="image_src"
This is located between the tags...doesn't seem to do anything.
Thoughts?
You can only change the title
everything else is fetched directly from the shared url.
i dont 100% understand what you want to do
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script>
Share
replace the u=location.href with u= and t=document.title with the given title. additionally replace in the href="" of the link with the correct url
any other info is fetched by the meta tags of the target url
<link rel="image_src" href="http://www.onjd.com/design05/images/PH2/WableAFC205.jpg" />
the href="" links to the correct image
the tag needs to be within those meta tags (in the area)

How to prevent favicon.ico requests?

I don't have a favicon.ico, but my browser always makes a request for it.
Is it possible to prevent the browser from making a request for the favicon from my site? Maybe some META-TAG in the HTML header?
I will first say that having a favicon in a Web page is a good thing (normally).
However it is not always desired and sometime developers need a way to avoid the extra payload. For example an IFRAME would request a favicon without showing it.
Worst yet, in Chrome and Android an IFRAME will generate 3 requests for favicons:
"GET /favicon.ico HTTP/1.1" 404 183
"GET /apple-touch-icon-precomposed.png HTTP/1.1" 404 197
"GET /apple-touch-icon.png HTTP/1.1" 404 189
The following uses data URI and can be used to avoid fake favicon requests:
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
For references see here:
https://github.com/h5bp/html5-boilerplate/issues/1103
https://twitter.com/diegoperini/status/4882543836930048
UPDATE 1:
From the comments (jpic) it looks like Firefox >= 25 doesn't like the above syntax anymore. I tested on Firefox 27 and it doesn't work while it still work on Webkit/Chrome.
So here is the new one that should cover all recent browsers. I tested Safari, Chrome and Firefox:
<link rel="icon" href="data:;base64,=">
I left out the "shortcut" name from the "rel" attribute value since that's only for older IE and versions of IE < 8 doesn't like dataURIs either. Not tested on IE8.
UPDATE 2:
If you need your document to validate against HTML5 use this instead:
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
Just add the following line to the <head> section of your HTML file:
<link rel="icon" href="data:,">
Features of this solution:
100% valid HTML5
very short
does not incur any quirks from IE 8 and older
does not make the browser interpret the current HTML code as favicon (which would be the case with href="#")
You can use the following HTML in your <head> element:
<link rel="shortcut icon" href="#" />
I tested this on a forced full refresh, and no favicon requests were seen in Fiddler. (tested against IE8 in compat mode as IE7 standards, and FF 3.6)
Note: this may download the html file twice, so while it works in hiding the error, it comes with a cost.
You can't. All you can do is to make that image as small as possible and set some cache invalidation headers (Expires, Cache-Control) far in the future. Here's what Yahoo! has to say about favicon.ico requests.
if you use nginx
# skip favicon.ico
#
location = /favicon.ico {
access_log off;
return 204;
}
Put this into your HTML head:
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC">
This is a bit larger than the other answers, but does contain an actually valid PNG image (1x1 pixel white).
The easiest way to block these temporarily for testing purposes is to open up the inspect page in chrome by right-clicking anywhere on the page and clicking inspect or by pressing Ctrl+Shift+j and then going to the networking tab and then reloading the page which will send all the requests your page is supposed to make including that annoying favicon.ico. You can now simply right click the favicon.ico request and click "Block request URL".
All of the above answers are for devs who control the app source code. If you are a sysadmin, who's figuring out load-balancer or proxying configuration and is annoyed by this favicon.ico shenanigans, this simple trick does a better job. This answer is for Chrome, but I think there should be a similar alternative which you would figure out for Firefox/Opera/Tor/any other browser :)
You can use .htaccess or server directives to deny access to favicon.ico, but the server will send an access denied reply to the browser and this still slows page access.
You can stop the browser requesting favicon.ico when a user returns to your site, by getting it to stay in the browser cache.
First, provide a small favicon.ico image, could be blank, but as small as possible. I made a black and white one under 200 bytes. Then, using .htaccess or server directives, set the file Expires header a month or two in the future. When the same user comes back to your site it will be loaded from the browser cache and no request will go to your site. No more 404's in the server logs too.
If you have control over a complete Apache server or maybe a virtual server you can do this:-
If the server document root is say /var/www/html then add this to /etc/httpd/conf/httpd.conf:-
Alias /favicon.ico "/var/www/html/favicon.ico"
<Directory "/var/www/html">
<Files favicon.ico>
ExpiresActive On
ExpiresDefault "access plus 1 month"
</Files>
</Directory>
Then a single favicon.ico will work for all the virtual hosted sites since you are aliasing it. It will be drawn from the browser cache for a month after the users visit.
For .htaccess this is reported to work (not checked by me):-
AddType image/x-icon .ico
ExpiresActive On
ExpiresByType image/x-icon "access plus 1 month"
A very simple solution is put the below code in your .htaccess. I had the same issue and it solve my problem.
<IfModule mod_alias.c>
RedirectMatch 403 favicon.ico
</IfModule>
Reference: http://perishablepress.com/block-favicon-url-404-requests/
Elaborating on previous answers, this might be the shortest solution from the HTML file itself:
<link rel="shortcut icon" href="data:" />
Tested working, no error messages or failed requests on Chrome Version 94.0.4606.81
Just make it simple with :
<link rel="shortcut icon" href="#" type="image/x-icon">
It displays nothing!!!!
In Node.js,
res.writeHead(200, {'Content-Type': 'text/plain', 'Link': 'rel="shortcut icon" href="#"'} );
Personally I used this in my HTML head tag:
<link rel="shortcut icon" href="#" />
I need prevent request AND have icon displayed i.e. in Chrome.
Quick code to try in <head>:
<link rel="icon" type="image/png" sizes="16x16" href="data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEU0OkArMjhobHEoPUPFEBIu
O0L+AAC2FBZ2JyuNICOfGx7xAwTjCAlCNTvVDA1aLzQ3COjMAAAAVUlEQVQI12NgwAaCDSA0888G
CItjn0szWGBJTVoGSCjWs8TleQCQYV95evdxkFT8Kpe0PLDi5WfKd4LUsN5zS1sKFolt8bwAZrCa
GqNYJAgFDEpQAAAzmxafI4vZWwAAAABJRU5ErkJggg==" />
In our experience, with Apache falling over on request of favicon.ico, we commented out extra headers in the .htaccess file.
For example we had
Header set X-XSS-Protection "1; mode=block"
... but we had forgotten to sudo a2enmod headers beforehand. Commenting out extra headers being sent resolved our favicon.ico issue.
We also had several virtual hosts set up for development, and only failed out with 500 Internal Server Error when using http://localhost and fetching /favicon.ico. If you run "curl -v http://localhost/favicon.ico" and get a warning about the host name not being in the resolver cache or something to that effect, you might experience problems.
It could be as simple as not fetching (we tried that and it didn't work, because our root cause was different) or look around for directives in apache2.conf or .htaccess which might be causing strange 500 Internal Server Error messages.
We found it failed so quickly there was nothing useful in Apache's error logs whatsoever and spent an entire morning changing small things here and there until we resolved the problem of setting extra headers when we had forgotten to have mod_headers loaded!
Sometimes this error comes, when HTML has some commented code and browser is trying to look for something. Like in my case I had commented code for a web form in flask and I was getting this.
After spending 2 hours I fixed it in the following ways:
1) I created a new python environment and then it threw an error on the commented HTML line, before this I was only thrown error 'GET /favicon.ico HTTP/1.1" 404'
2) Sometimes, when I had a duplicate code, like python file existing with the same name, then also I saw this error, try removing those too
If you are not using HTML and it's auto-generated by Flask or some frameworks you can always add a dummy route in the app to just return dummy text to fix this issue.
Or
.
.
.
you can just add the favicon :)
Eg for Python Flask Application.
#app.route('/favicon.ico')
def favicon():
return 'dummy', 200
I solved this problem by using the Content-Security-Policy HTTP response header. By using this, is possible to block the browser from making further media queries like images (other types are also possible). I added the following header to the response:
Content-Security-Policy: img-src 'none'
The problem is it will block ALL image queries. If your HTML has any image, they won't be loaded. In my case it was very likely a bug in Firefox because the browser was requesting the favicon.ico for a response whose Content-type is text/xml!
It also depends on the browser implementing this feature as is enforced on the client side.
Check https://content-security-policy.com for a complete guide on CSP.
Cheers!
You could use
<link rel="shortcut icon" href="http://localhost/" />
That way it won't actually be requested from the server.

Iframe Size problem in facebook iframe application

I have an iframe application which works fine but the issue comes when the content of iframe is large the text appears to be cut down.
I registered the application as iframe and set as resizable.
I have applied the following code but nothing seems to work
<div id="FB_HiddenIFrameContainer" style="display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;"></div>
<script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
FB_RequireFeatures(["CanvasUtil"], function(){
FB.XdComm.Server.init(xd_receiver.htm);
FB.CanvasClient.setSizeToContent();
});
</script>
I have xd_receiver.htm file in myapp folder.
Please help me on this
In my iframe app I use
FB.CanvasClient.startTimerToSizeToContent();
instead of setSizeToContent() which seems to work for me.
Edit:
Can your javascript actually see the xd_receiver.htm file? Does it need a path (absolute or relative?) Is Apache serving static files from that directory?
What browsers have you observed the problem in? Try running in firefox with firebug installed to debug javasript problems. I'm not sure if the code you posted is actually what you're using, but it seems to be missing quotes on the "xd_receiver.htm" and also, no api key.
Regarding the xd_receiver.htm--> If the path to your callback url is callback, it should exist at callback/xd_receiver.htm. You have specified a relative path, so if your canvas page lives at /foo/page.htm, then the receiver page should exist at /foo/xd_receiver.htm. You could also specify at absolute path like '/xd_receiver.htm' and just keep your xd_receiver at the root.
Your page should look something like this:
http://gist.github.com/156633