javascript alert not working from address bar

RESOLVED WONTFIX

Status

()

Firefox
General
RESOLVED WONTFIX
7 years ago
7 years ago

People

(Reporter: Owen Leibman, Unassigned)

Tracking

6 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110622232440

Steps to reproduce:

I typed the following in the area which I usually use to navigate to a URL:
javascript:alert('hello')
I sometimes use similar commands as a crude means of debugging.


Actual results:

Nothing shows on my page. On the error console, however:
uncaught exception: ReferenceError: alert is not defined

If I change to use window.alert, I instead see "window is not defined"


Expected results:

Should have displayed a popup showing my alert message. This worked up till FF5, and broke with the FF6 push today.
(Reporter)

Updated

7 years ago
Version: 5 Branch → 6 Branch
(Reporter)

Updated

7 years ago
OS: Linux → Windows XP
Hardware: x86_64 → x86

Comment 1

7 years ago
Caused by bug 656433 and was done for security reasons (facebook scams like "paste this in your URL bar" or "Ctrl-C,L,V then Enter" and bam, a scammer has access to your friends list).

You can use the the web developer features in Firefox (under Tools > Web Developer) to do things like try out bits of Javascript.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WONTFIX
https://developer.mozilla.org/En/Firefox_6_for_developers
* For security reasons, data: and javascript: URIs no longer inherit the security context of the current page when the user enters them in the location bar; instead, a new, empty, security context is created. This means that script loaded by entering javascript: URIs in the location bar no longer has access to DOM methods and the like, for example. These URIs continue to work as before when used by script, however.

https://developer.mozilla.org/en/Tools/Scratchpad can interact with pages.
Duplicate of this bug: 680019

Comment 4

7 years ago
This breaks functionality at major Web sites like HomeDepot.com. There are several applications on the site that make use of javascript: links to function and they no longer work in FF 6.0.

Comment 5

7 years ago
I should clarify that the breakage happens after clicking on an element with an associated javascript: URI. After clicking, all JavaScript functions on the page no longer respond to user input.

Comment 6

7 years ago
WFM in safemode.

Comment 7

7 years ago
data:text/html,<script>alert(0)</script>

:/

that the point?
Duplicate of this bug: 680458

Comment 9

7 years ago
I'm expecting that at least for advanced user this can be configured in the about:config page, because if some people are stupid not everybody must pay for them! At least in Europe the law doesn't protect stupid people and I'm really happy with it!
Ah when the next scam will be "copy paste this code in the scratchpad" you will remove also the scratchpad?

"The wicked sometimes rest, fools never." (Eros Drusiani)
Duplicate of this bug: 682279
Duplicate of this bug: 682569

Comment 12

7 years ago
How do I re-enable this feature.  I have bookmarks that use javascript.  This is one of them and it no longer works.

javascript:self.resizeTo(1024,768)

Also we have a custom firefox client that is used for a single internal web site and it needs this feature as well.  This will prevent us from upgrading.

Comment 13

7 years ago
(In reply to Aquila from comment #9)
> I'm expecting that at least for advanced user this can be configured in the
> about:config page, because if some people are stupid not everybody must pay
> for them! At least in Europe the law doesn't protect stupid people and I'm
> really happy with it!
> Ah when the next scam will be "copy paste this code in the scratchpad" you
> will remove also the scratchpad?
> 
> "The wicked sometimes rest, fools never." (Eros Drusiani)

I couldn't agree more.  How can they remove a critical piece of functionality without having a way to turn it back on.

Comment 14

7 years ago
Work in bookmarks, but not work when paste code in nav barr.
Tested in firefox 7.0.1

Check error console.

Comment 15

7 years ago
It gets Error: uncaught exception: ReferenceError: self is not defined
Window is not defined either.  So the script doesn't run in a bookmark

Comment 16

7 years ago
I use this bookmark a lot, and it works in FF7:

javascript:var%20c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var%20l=12;var%20r='';for%20(var%20i=0;%20i<l;%20i++)%20{var%20n=Math.floor(Math.random()*c.length);r+=c.substring(n,n+1);}void(prompt('Here%20is%20your%20string:',r))
You need to log in before you can comment on or make changes to this bug.