"Save link as" in Right-click Context menu is not working properly.
Firefox 17: In a Google search, when I right click on a .pdf link, the popup window automatically gives a "url" filename and "Firefox Document" as filetype. Previously, the filename would be whatever it was on the website (ie. "filename.pdf") and the filetype would be "Adobe Acrobat Document".
I know this problem has less to do with Firefox and more to do with JavaScript, because the problem disappears if you disable JavaScript (Tools -- Options -- Content -- uncheck "Enable JavaScript"). What's happening is that JavaScript is somehow altering the link from a purely .pdf link to something else -- perhaps encasing the link inside a set of commands, and the computer is trying to save the command string instead of recognizing the link for what it is. When JavaScript is disabled in Google searches, the highlighted "[PDF]" link no longer appears in front of the link itself, and the "Save link as" function on the right-click works properly.
Any JavaScript junkies want to try their hand at creating a workaround? One that ensures that the reference created by the right-click context menu matches exactly what the filename is for the website?
All Replies (4)
The problem is that Google has an onmousedown attribute added to the links that modify a link if you click or right-click a result link to make the link point to a safe browsing check on the Google server.
You can see that if you hover a link and you will notice that after you have (right) click a link the the URL changes to www.google.com/url?xxxxx.
You can use this bookmarklet to remove the onmousedown attributes.
javascript:(function(){var e=document.querySelectorAll('*[id="search"] a[onmousedown]'),E,i;for(i=0;E=e[i];i++){E.removeAttribute('onmousedown')}})()
Hey that's great, thanks for figuring this out. So how do I use that long line of code you provided? I'm not familiar with editing JavaScript. Do I change Firefox or do I modify my Google page in some way?
Nevermind, I figured it out...
https://support.mozilla.org/en-US/kb/bookmarklets-perform-common-web-page-tasks
I found a nice workaround called STRAIGHT GOOGLE. You install it as a Firefox Add-On.
http://userscripts.org/scripts/show/121261
userscripts.org/scripts/source/121261.user.js