Nowadays, modern browsers don’t allow running of JavaScript from url the  bar due to security reasons, then how do you run a JavaScript command in Firefox or Chrome?. For instance, if you want to know when a web page was updated last time, you’ve need to run javascript:alert(document.lastModified) command.

Now, when you copy and paste it in the address bar and press enter, then, the browser displays the search results for that with the default search engine, and command simply won’t execute.

Stop Annoying JavaScript Popups in Chrome with this Extension

Running JavaScript Commands in Chrome and Firefox

Chrome:

1. Open the web page or site, for which, you want to know the recent updated time.

2. Now from the Chrome menu > More Tools > Select  ‘JavaScript Console’ or use Ctrl+Shift+ J shortcut instead or you can simply bring it up by right clicking on the page and select ‘Inspect element’, now click on Console…. So many ways to open the JavaScript Console in Chrome.

3. Once JS Console opens at the bottom of the window, clear the console log, and type the script you want to execute and press enter, a pop up dialog appears on top and shows the result (check the screenshot below), click on ‘OK’ to dismiss it.

running JavaScript Chrome

Disable JavaScript in Chrome, Firefox, Opera and Internet Explorer Browsers

Firefox

1. Open Web Developer Tools (or use the shortcut Ctrl+Shift+I) and select the Scratchpad (Shit+F4)

2. Once it opens, paste the JavaScript command and click on ‘Run’ at the top to run the script.

running JavaScript in Firefox using scratchpad

Have you found this tip useful? Let us know in the comments.