If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

window.location changes URL to absolute path




Developer Tools
5 years ago
4 years ago


(Reporter: obrufau, Unassigned)


14 Branch
Windows XP

Firefox Tracking Flags

(Not tracked)



(2 attachments)



5 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120713134347

Steps to reproduce:

If you do window.location=something (such as window.location='google.com'), or window.location.replace() with one or two arguments (such as window.location.replace('google.com','abc'))

Actual results:

The location bar shows an strange URL, which I guess is the absolute path in my computer:
jar:file:///C:/Archivos de programa/Mozilla Firefox/Firefox 14/omni.ja!/chrome/browser/content/browser/google.com

Additional data:
->I have Firefox installed on C:\Archivos de programa\Mozilla Firefox\Firefox 14\
->"google.com" at the end of the URL is the first argument of window.location.replace(), or the string "something" in window.location=something.

Moreover, with window.location.replace(), you can't go back to the page you were.

Comment 1

5 years ago
Fixed on Firefox 15 beta
Please provide a testcase.
Aren't you missing the protocol e.g. http://google.com ?
Component: Untriaged → DOM
Product: Firefox → Core

Comment 3

5 years ago
If I do it from a <script> it works well and there isn't any bug:
for example, in http://localhost/bug.htm:
   <script type="text/javascript">
   "use strict";
It redirects to http://localhost/abc

But if I load http://localhost/bug.htm (without redirection script), open the console or scratchpad and enter...

... it redirects me to

So I can't provide a testcase.
window.location='abc'; is a relative URL and the absolute URL based on your current location (sratchpad) is the result that you get.
Component: DOM → Developer Tools
Product: Core → Firefox

Comment 5

5 years ago
Well, but I think it should be interpreted as a relative URL based on the current page, even if the script is executed from console/scratchpad instead of the page.

But If you think that it shouldn't, then the bug is that Firefox 15 interpretes it like I want...

Comment 6

5 years ago
Created attachment 651124 [details]
Screenshot of the error

Comment 7

5 years ago
Created attachment 651127 [details]
Screnshot of the bug 2

Curiously, if I do window.location='', Firefox loads itself into current tab... weird

Comment 8

4 years ago
Fixed on Firefox 15 beta
Last Resolved: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.