Closed Bug 1281375 Opened 8 years ago Closed 8 years ago

Navigating to a javascript URL does not override the document's URL

Categories

(Core :: DOM: Core & HTML, defect, P2)

47 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 836567

People

(Reporter: dominicc, Assigned: jdai)

References

()

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
Build ID: 20160606114208

Steps to reproduce:

1. Open the following URL:
   data:text/html,<a href="javascript:`<button onclick='alert(document.location)'>X`">W
2. Click on W
3. Click on X


Actual results:

There's an alert containing javascript:...


Expected results:

The URL in the alert dialog should start with data:text/html,...

The document's URL should have been overridden and match the original URL; see step 14.10 of <https://html.spec.whatwg.org/multipage/browsers.html#navigate>

A user reported a difference in Firefox and Chrome navigation behavior with javascript URLs in <https://crbug.com/398761>. I think this may be related to that.
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Hi John, could you please take a look? Thanks!
Flags: needinfo?(jdai)
Assignee: nobody → jdai
Flags: needinfo?(jdai)
Hmm, the spec is surprising here. I filed https://github.com/whatwg/html/issues/1565
Would be good to test what Edge and Safari do here.
(Edge may not run data:urls from location bar so would need to modify the test a bit)
I was following reporter's link [1],
OS  : Mac OS X
Url : http://weather.edition.cnn.com/weather/intl/forecast.jsp?celcius=true&locCode=UKXX0085&zipCode=336736767676
Reproduce step: Click Celsius sign (C) on the page.

Edge 11 and Safari 9.1.1 (11601.6.17) are working fine.

[1] https://crbug.com/398761
Well, that chromium bug is old, so sure the page has changed.
But how do other browsers deal with javascript: urls?
Flags: needinfo?(jdai)
Attached file test.html
OS  : Mac OS X and Windows 10
File: As attachment
Reproduce step: 
1. Open test.html
2. Click on W
3. Click on X
Result:
Firefox 47: 
There's an alert containing javascript:...
Edge 11: 
The URL in the alert dialog which has file://.../test.html
Chrome 51.0.2704.106: 
The URL in the alert dialog which has file://.../test.html
Safari 9.1.1 (11601.6.17):
Can’t get response after click on a link W.
Flags: needinfo?(jdai)
thanks. Ok sounds like we should then follow the current spec.
Just not yet clear to me how.
If you have a different opinion, please feel free to modify the priority, John and Olli.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
I believe this is duplicate to bug 836567. Feel free to reopen it if you have concern.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: