How to Run JavaScript Commands in Chrome and Firefox Browsers?

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 rely on running 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 thumb How to Run JavaScript Commands in Chrome and Firefox Browsers?

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 thumb How to Run JavaScript Commands in Chrome and Firefox Browsers?

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

Venkat Eswarlu

Venkat is an independent technology journalist and the founder of Techdows. He has been covering web browsers, Windows, and software news since 2009. His exclusive scoops on Chrome, Firefox, and Edge features have been cited by Forbes, TechCrunch, Wired, CNET, and other major publications.

Leave a Reply

Your email address will not be published. Required fields are marked *