JavaScript executed through address bar is not working in Firefox 7, 8

5

1

JavaScript executed through address bar is not working in Firefox 7, 8. For example, the code below works in Chrome, when I paste it into the address bar and press Enter:

javascript:alert("hello world!");

In the latest Firefox, it's not working. Why? How can I make it work?

Vishnu Dina

Posted 2011-11-14T14:54:30.037

Reputation:

What is your practical application of that feature? – Šime Vidas – 2011-11-14T14:56:19.710

1i just need to run javascript through adress bar – None – 2011-11-14T14:59:20.047

See this other question about the behavior. – Pointy – 2011-11-14T14:59:46.433

You can run Javascript using Firebug. – Sjoerd – 2011-11-14T15:00:19.000

no i just wanna make it simple...i know some work around is there for it – None – 2011-11-14T15:02:32.633

@Vishnu Opening the browser's JavaScript console is simple... I don't understand... – Šime Vidas – 2011-11-14T15:03:37.733

ctrl+shift+k ?? – None – 2011-11-14T15:06:22.097

@Vishnu How to open the JavaScript console in different browsers

– Šime Vidas – 2011-11-14T15:07:15.537

You can find answer here. http://support.mozilla.com/en-US/questions/885558

– Riz – 2011-11-14T14:56:49.273

i cant find any solution from your url – None – 2011-11-14T14:58:50.407

1From that URL: "Starting in Firefox 6 javascript in the url-bar runs with a null security principal for security reasons. This means it's almost disabled. You need a bookmarklet or an add-on for a workaround." – Quentin – 2011-11-14T15:00:02.540

The feature has been disabled in Firefox. – Pointy – 2011-11-14T15:00:26.697

is there any other way to make it work???? other than addon – None – 2011-11-14T15:01:13.803

You need a bookmarklet or an add-on for a workaround. – Riz – 2011-11-14T15:02:05.697

@imeVidas: My application is using keywords to modify the URL or the page in the same manner as a bookmarklet, but without manually clicking or cluttering up the toolbar with bookmarklet icons. Anyone have a solution for this? There's no way to disable the disabler in about:config? – endolith – 2012-05-10T20:37:40.353

Answers

3

It's a security issue. Other browsers will follow this restriction...

Use firebug instead ;)

frank_neff

Posted 2011-11-14T14:54:30.037

Reputation:

0

If you want to execute javascript from url, then you have to use like this:

let's say, you have site: http://www.site.com/post.php. then in post.php, insert:

if (!empty($_GET['action']) && $_GET['action'] == myfunction ){
echo '<script>alert("Hi User");</script>';
}

after that, when you enter: http://www.site.com/post.php?action=myfunction

then the script will be shown.

T.Todua

Posted 2011-11-14T14:54:30.037

Reputation: 2 436