Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Nov 14 '11 at 21:27

This question came from our site for professional and enthusiast programmers.

    
What is your practical application of that feature? – Šime Vidas Nov 14 '11 at 14:56
    
You can find answer here. support.mozilla.com/en-US/questions/885558 – Rizwan Nov 14 '11 at 14:56
    
i cant find any solution from your url – Vishnu Dina Nov 14 '11 at 14:58
1  
i just need to run javascript through adress bar – Vishnu Dina Nov 14 '11 at 14:59
1  
From 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 Nov 14 '11 at 15:00

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

Use firebug instead ;)

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.