window.location works wrong in FF6

UNCONFIRMED
Unassigned

Status

()

Firefox
General
UNCONFIRMED
7 years ago
7 years ago

People

(Reporter: lars.hansen, Unassigned)

Tracking

6 Branch
x86
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 554634 [details]
leereSeite.html

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Firefox/6.0
Build ID: 20110811165603

Steps to reproduce:

Let run a JavaScript


Actual results:

Current Page reloads


Expected results:

Page as specified by JavaScript should have been loaded
Attachment #554634 - Attachment mime type: text/plain → text/html
(Reporter)

Comment 1

7 years ago
Attached is the page containing the JavaScript in question. (This page is meant to be the start page for empty tabs in FFs fullscreen mode because there is no adress bar in FFs fullscreen mode.)

The page resides in the local filesystem. Its url is a file:// url.

A web url is typed into the text box and "Enter" is pressed.

When window.location is used in JavaScript, the current page (file://) reloads while the value assigned to window.location should have been loaded.

Comment 2

7 years ago
Removing <form> and </form> makes the program work. Someone else has to explain why.

BTW, your example has two </body>, but it doesn't seem to affect the test results.

Comment 3

7 years ago
Just for testing...

This loads the new location when typing any letter:

<!doctype html>
<html>
  <head>
    <script type="text/javascript">
      function gotolocation(e)
      {
      window.location="http://www.example.com"; 
      }
    </script>
  </head>
  <body>
    <form>
      Type any letter: <input type="text" onkeypress="javascript:gotolocation(event)" id="adress" />
    </form>
  </body>
</html>

But this loads the old location when pressing Enter:
<!doctype html>
<html>
  <head>
    <script type="text/javascript">
      function gotolocation(e)
      {
      if(e.keyCode==13){
      window.location="http://www.example.com"; 
      }
      }
    </script>
  </head>
  <body>
    <form>
      Press Enter: <input type="text" onkeypress="javascript:gotolocation(event)" id="adress" />
    </form>
  </body>
</html>
You need to log in before you can comment on or make changes to this bug.