Copy Link Location adds %20 where spaces should be in JAVASCRIPT links (messes up the js function when pasting somewhere else)

Bug #256219 reported by JasonSpradlin82 on 2008-08-08
4
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: firefox-3.0

on this page:
http://www.streamingfaith.com/directory/network.aspx?nsn=ABLFC

there is a link that reads "Click here to view now!"

The HREF is javascript:OpenPopup('/faithpass/index.aspx?nsn=ABLFC', _sWindowName, _iWidth, _iHeight, _sScrollYesNo, _sResizableYesNo);

When you right click the text link, however, and select Copy Link Location, Firefox (3.0+ only) converts the spaces between the JS variables into %20. This is fine for standard HTTP:// links, but it breaks the javascript link when I try to paste it elsewhere. It looks like this:

javascript:OpenPopup('/faithpass/index.aspx?nsn=ABLFC',%20_sWindowName,%20_iWidth,%20_iHeight,%20_sScrollYesNo,%20_sResizableYesNo);

Every time I copy a link this way, i have to paste it into a text editor and then replace all "%20" with a space. Then i have to recopy that if I want to paste the link somewhere else.

This did NOT happen in Firefox 2.x browsers. This is something I use DAILY at work (I work for Streaming Faith) and it really makes things difficult, because when (not if) I forget to remove the %20s, the javascript function doesn't run.

Alexander Sack (asac) wrote :

isnt this the opposite of the bug claimed in: https://bugzilla.mozilla.org/show_bug.cgi?id=440075 ?

Changed in firefox-3.0:
status: New → Incomplete

Kind of, but no.

That bug references a direct copy (using ctrl-c or "copy" on the context
menu) of text located in the address bar... In that case, the code that
moves the selected text to the clipboard and accidentally translates
the %20 into a space.

In THIS bug, it only occurs when RIGHT CLICKING a link and selecting
copy link location. This time, it does do the opposite, but it makes
sense to have it do this for the following reasons:

if I coded a page with <a href="www.google.com/fun times"> (made up
link) then the browser needs to know to use URL encoding because the
REAL address WILL actually be ..."fun%20times"

However, when using <a href="javascript:whatever(something, something
else)"> we are not referencing a URL at all... We are calling a
javascript command defined somewhere on the page or in an included
file. Firefox should NEVER presume to URL encode a link containing a
javascript command, because URL encoding should only apply to URLs.

Jason Spradlin
Atlanta, GA

Alexander Sack wrote:

> isnt this the opposite of the bug claimed in:
> https://bugzilla.mozilla.org/show_bug.cgi?id=440075 ?
>
> ** Changed in: firefox-3.0 (Ubuntu)
> Status: New => Incomplete
>
>

JasonSpradlin82 (jaspradlin) wrote :

Kind of, but no.

That bug references a direct copy (using ctrl-c or "copy" on the context menu) of text located in the address bar... In that case, the code that moves the selected text to the clipboard and accidentally translates the %20 into a space.

In THIS bug, it only occurs when RIGHT CLICKING a link and selecting copy link location. This time, it does do the opposite, but it makes sense to have it do this for the following reasons:

if I coded a page with <a href="www.google.com/fun times"> (made up link) then the browser needs to know to use URL encoding because the REAL address WILL actually be ..."fun%20times"

However, when using <a href="javascript:whatever(something, something else)"> we are not referencing a URL at all... We are calling a javascript command defined somewhere on the page or in an included file. Firefox should NEVER presume to URL encode a link containing a javascript command, because URL encoding should only apply to URLs.

Jason Spradlin
Atlanta, GA

(P.S. does replying to a bug email add a comment to this bug, or not?)

JasonSpradlin82 (jaspradlin) wrote :

I can see that the change in FF3 was made as a FEATURE... so that right clicking a link that contains a URL with a space would be properly encoding when pasting the link elsewhere (like the "fun%20times" example).

However, I don't the developer who coded this feature considered how it would affect other HREF values such as javascript commands.

JC Hulce (soaringsky) on 2012-03-13
Changed in firefox-3.0 (Ubuntu):
status: Incomplete → New
Thomas Hotz (thotz) on 2013-10-17
affects: firefox-3.0 (Ubuntu) → firefox (Ubuntu)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.