Firefox reads link incorrectly
I have a problem similar to this closed thread (http://support.mozilla.org/en-US/questions/857056#answer-224505) where Firefox couldn't handle backslashes in the link to a pdf file.
On a website (that you won't be able to access) there is a link to a pdf file. When I click on the link I get the error "The system cannot find the file specified", but it works in IE and Chrome.
When I copy the link address, Firefox copies: http://webserver1a.charlottechristian.com/NetClassroom7/Forms/%5C%5Clsserver3.charlottechristian.com/ClassDocuments/9934/Honors%20Physics%20Notebook%202012-13.pdf
The %5C are backslashes. The other browsers only copy what is after the backslashes. They start with the lserver3.
Possibly the site is not designed well, but I have no control over that.
Why would the other browsers copy and go to the link correctly, but Firefox not. I did try refreshing the cache and the slashy add-on mentioned in the other thread, and I tried in in safe mode.
所有回复 (11)
The problem is that IE and Chrome are tolerating the illegal use of backspaces as separators in links. As a result of this, websites that make the same mistake are still functioning well in IE and Chrome, and do not work in Firefox. The only way to solve this problem is to repair the website.
Unfortunately, I have no control over the website. And I've encountered it on other sites.
And actually I'm not sure that explains it. Firefox tries to go to:
http://webserver1a.charlottechristian.com/NetClassroom7/Forms/%5C%5Clsserver3.charlottechristian.com/ClassDocuments/9934/Honors%20Physics%20Notebook%202012-13.pdf
But the actual html code is:
<A HREF="http:\\lsserver3.charlottechristian.com/ClassDocuments/9934/Honors Physics Notebook 2012-13.pdf" target='#'>
It's like Firefox prefixes some text from elsewhere before the correct url
由cor-el于
Firefox sees such a link as a relative link and prefixes them with the path of the current web page.
- \\lsserver3.charlottechristian.com/ClassDocuments/9934/Honors Physics Notebook 2012-13.pdf
So it looks that the link to the PDF file is on the http://webserver1a.charlottechristian.com/NetClassroom7/Forms/ page.
Visitors can use an extension use a bookmarklet to fix this issue, but you need to change the %5C backslashes (\) to forward slashes in all links to make it work in Firefox.
It's like Firefox prefixes some text from elsewhere before the correct url."
I would like to say something about that line. Actually the url is not correct at all. And it seems to me that Firefox is trying to build a complete url from a relative one, which makes sense if you do not give the backslashes a special meaning. So I cannot think of a reason why this should be a problem of Firefox.
My advice in this situation is to simply open this crappy IE-only site with IE.
It is a bit sad to see that some sites are made by people who have no idea what they are doing.
I posted a bookmarklet for "a" links in this thread:
javascript:(function(){var a='href',e='a',c=0;function R(w){try{var i,L,r=1;E=w.document.querySelectorAll(e+'['+a+']');for(i=0;L=E[i];i++){if(/\\/g.test(unescape(L.getAttribute(a)))){L.setAttribute(a,unescape(L.getAttribute(a)).replace(/\\/g,'\/'));c++;}}}catch(e){r=0}return(r)}R(self);var i,x;for(i=0;x=frames[i];++i)R(x);alert('Found\n'+c);})();
So why does Firefox see the link as relative and the other browsers do not?
I tried the slashy add-on, but it did not help. I guess I don't understand how it 'fixes backslash file separators'. And I'm not sure that is the problem in this case. The problem is the prefixing by acting like is a relative address.
I saw the bookmarklet thing, but don't understand what I am supposed to do with that bit of javascript.
The site is by blackbaud, and I have no doubt is is poorly designed. Unfortunately I cannot change that.
I could use it in Chrome or (gag) IE, but I still prefer Firefox.
Firefox only sees the protocol http: and not two forward slashes that make a proper link.
So Firefox uses the current URL and adds the remainder of the link to it just as happens if the http: part is missing.
It used to be possible to disable that feature in IE (Windows) via the TweakUI powertoys.
I don't know if that still works.
Thank you both for your help. I am learning, slowly. I see the programer is in error and uses \\ instead of // . I still don't see how to make FF work on this poor site, however.
I looked a little closer at the slashy add-on. The html in the source code is unchanged, it is still with the back slashes: <A HREF="http:\\lsserver3.charlottechristian.com/ClassDocuments/9934/Honors Physics Notebook 2012-13.pdf" target='#'>
When I copy the link in Firefox, the \\ is converted to // but it is still prefixed (treated as relative) http://webserver1a.charlottechristian.com/NetClassroom7/Forms//lsserver3.charlottechristian.com/ClassDocuments/9934/Honors%20Physics%20Notebook%202012-13.pdf
Maybe FF is doing the technically correct thing by not fixing a bad site's error, but that's a tough sell when other browsers do what the user expects.
The bookmarklet that I posted above is able to fix the link with this test code (run via the location bar).
data:text/html;charset=utf-8;base64,PEEgSFJFRj0iaHR0cDpcXGxzc2VydmVyMy5jaGFybG90dGVjaHJpc3RpYW4uY29tL0NsYXNzRG9jdW1lbnRzLzk5MzQvSG9ub3JzIFBoeXNpY3MgTm90ZWJvb2sgMjAxMi0xMy5wZGYiIHRhcmdldD0nIyc+SG9ub3JzIFBoeXNpY3MgTm90ZWJvb2sgMjAxMi0xMy5wZGY8L2E+
Took me awhile to figure out how to run it, but I created a bookmark with this code as the Location. It worked, so I thank you, thank you!
I still wish, however -- and I can be so picky -- that it was more transparent. Maybe an add-on or a config setting. As it is you have to have the presence of mind to run this bookmarklet whenever you run into this problem.
Or maybe when Firefox can't find the url, it asks what you want done, one of the options would be link to absolute address.
Thank you for your help!