Closed
Bug 781805
Opened 12 years ago
Closed 11 years ago
window.location changes URL to absolute path
Categories
(DevTools :: General, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: obrufau, Unassigned)
Details
Attachments
(2 files)
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 2•12 years ago
|
||
Please provide a testcase. Aren't you missing the protocol e.g. http://google.com ?
Component: Untriaged → DOM
Product: Firefox → Core
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"> //<![CDATA[ "use strict"; window.location='abc'; //]]> </script> It redirects to http://localhost/abc But if I load http://localhost/bug.htm (without redirection script), open the console or scratchpad and enter... window.location='abc'; ... it redirects me to jar:file:///C:/Archivos%20de%20programa/Mozilla%20Firefox/Firefox%2014/omni.ja!/chrome/browser/content/browser/abc So I can't provide a testcase.
Comment 4•12 years ago
|
||
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
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...
Curiously, if I do window.location='', Firefox loads itself into current tab... weird
Fixed on Firefox 15 beta
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•