Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

"Save link as" in Right-click Context menu is not working properly.

  • 4 replies
  • 4 have this problem
  • 2 views
  • Last reply by ice2112

more options

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?

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)

more options

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')}})()
more options

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?

more options
more options

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