Sorry, not likely to happen (except as a security hole). Your in-page JavaScript is deliberately sandboxed and limited - it can interact with the page, and with the network through AJAX, but it cannot and should not interact with other things that happen in your computer - including the browser.

Answer from Piskvor left the building on Stack Overflow
🌐
Chrome Developers
developer.chrome.com › docs › chrome devtools › console overview
Console overview | Chrome DevTools | Chrome for Developers
September 21, 2024 - Web developers often log messages to the Console to make sure that their JavaScript is working as expected. To log a message, you insert an expression like console.log('Hello, Console!') into your JavaScript. When the browser executes your JavaScript and sees an expression like that, it knows that it's supposed to log the message to the Console.
🌐
Chrome Developers
developer.chrome.com › docs › chrome devtools › run javascript in the console
Run JavaScript in the Console | Chrome DevTools | Chrome for Developers
April 18, 2018 - This tutorial is designed so that you can open up the demo and try all the workflows yourself. When you physically follow along, you're more likely to remember the workflows later. Press Command+Option+J (Mac) or Control+Shift+J (Windows, Linux, ChromeOS) to open the Console, right here on ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-use-the-javascript-developer-console
How To Use the JavaScript Developer Console | DigitalOcean
May 19, 2022 - You can also enter into the Web Console with the keyboard shortcut CTRL + SHIFT + K on Linux and Windows, or COMMAND + OPTION + K on macOS. Now that you have accessed the Console, you can begin working within it in JavaScript. To open the JavaScript Console in Chrome, you can navigate to the ...
🌐
Balsamiq
balsamiq.com › support › faqs › browser-console
Finding your browser's developer console
It will automatically select the Console tab. To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer Tools.
🌐
BrowserStack
browserstack.com › home › guide › how to run javascript in chrome browser
How to Run JavaScript in Chrome Browser | BrowserStack
April 4, 2025 - Here’s how to run JavaScript in Chrome effectively. Launch Google Chrome browser. ... Or press Ctrl + Shift + I (Windows) or Cmd + Option + I (Mac) to open Developer Tools. In the Developer Tools, click on the Console tab.
Top answer
1 of 2
85

Chrome

Opening the “Console” panel of Chrome’s DevTools:

  • Windows and Linux: Ctrl + Shift + J

  • Mac OS: Cmd + Opt + J

Note: In addition to the “Console” panel, there also exists a smaller slide-up console which can be toggled via Esc while any of the other panels is active.

Full documentation


Firefox

Opening the “Console” panel in Firefox’s Developer Tools:

  • Windows: Ctrl + Shift + K

  • Mac OS: Cmd + Opt + K

Note: In addition to the “Console” panel, there also exists a smaller slide-up console which can be toggled via Esc while any of the other panels is active.

Full documentation


Internet Explorer

Opening the “Console” panel in Internet Explorer’s F12 Developer Tools:

  • F12, then click on the “Console” tab

Note: In addition to the “Console” panel, there also exists a smaller slide-up console which can be toggled via Ctrl + ` while any of the other panels is active.

Full documentation


Safari

Note: In order to view the console in Safari, you have to enable the “Show Develop menu in menu bar” setting in the “Advanced” pane of Safari’s preferences (screenshot).

Opening the “Console” panel in Safari’s Web Inspector:

  • Cmd + Opt + C

Note: In addition to the “Console” panel, there also exists a smaller slide-up console which can be toggled via Esc while any of the other panels is active.

Full documentation


Opera

  • Windows and Linux: Ctrl + Shift + I
  • Mac : ++I

Full documentation

2 of 2
11

To indirectly reach the Console in Opera (checked on v9.6) the shortcut is Ctrl+Shift+i while on Safari 5 (on Windows) it is Ctrl+Alt+i

I wish all the browser makers could get together to standardize the keyboard shortcuts.

Update: It appears that the REPL tab under the Scripts tab in Opera Dragonfly in Opera 11 is similar to the Console option that was available in previous Opera versions.

I did not found much documentation on REPL after a cursory search, except for this article which has an indirect reference.

I tried this command in REPL with the Google home page open & it executed fine i.e. it hid the Google logo - document.getElementById('logo').style.visibility = 'hidden';

🌐
Chrome Web Store
chromewebstore.google.com › detail › javascript-console-editor › ddmppghpeomnafjoenneolpbpfafkpeg
Javascript Console Editor - Chrome Web Store
A simple plugin that lets you run javascript against any page. Great for if you are testing functions or need to test selectors for tools like puppeteer, playwright or selenium. Once installed it adds an extra tab to the developer window that ...
Find elsewhere
🌐
Reddit
reddit.com › r/learnjavascript › chrome dev console: is there a way to execute js with ctrl+enter as opposed to just enter?
r/learnjavascript on Reddit: Chrome dev console: Is there a way to execute JS with Ctrl+Enter as opposed to just Enter?
March 26, 2023 -

When writing multiline JS in the dev console, you have to hit Shit+Enter to create a new line. However, sometimes I mess up and hit just Enter which executes the whole script. It's not a big deal for most scripts, but I am working with JS that sends data to an API, so accidental execution can be an annoyance. If I could change the shortcut to Ctrl+Enter to execute and use Enter to create a new line, that would be ideal.

🌐
JavaScript.info
javascript.info › tutorial › the javascript language › an introduction
Developer console
Developer tools allow us to see errors, run commands, examine variables, and much more. They can be opened with F12 for most browsers on Windows. Chrome for Mac needs Cmd+Opt+J, Safari: Cmd+Opt+C (need to enable first).
🌐
Mozilla
firefox-source-docs.mozilla.org › devtools-user › browser_console › index.html
Browser Console — Firefox Source Docs documentation
Similarly, you can execute JavaScript expressions using the Browser Console. But while the Web Console executes code in the page window scope, the Browser Console executes them in the scope of the browser’s chrome window.
🌐
Lucid
help.lucid.co › hc › en-us › articles › 360049395772-Troubleshooting-Open-the-JavaScript-Console
Troubleshooting: Open the JavaScript Console – Lucid
If you are having trouble loading your documents list, opening a Lucidchart document or Lucidspark board, or working in the editor, you can open the Javascript Console in your browser to identify p...
🌐
Chrome for Developers
developer.chrome.com › docs › chrome devtools › open chrome devtools
Open Chrome DevTools | Chrome for Developers
December 14, 2018 - With dedicated shortcuts that open Elements, Console, or the last panel you used.
🌐
LambdaTest
lambdatest.com › software-testing-questions › how-to-run-javascript-in-chrome-browser
How to Run JavaScript in Chrome Browser: A Quick Guide
Note: Test if JavaScript is enabled with LambdaTest’s tool! No sign-up required. Test if JavaScript is enabled! Press Ctrl + Shift + I (Windows) or Cmd + Option + I (Mac), then go to the Console tab.
🌐
Quora
quora.com › How-do-I-use-the-Chrome-console-to-edit-and-run-JavaScript
How to use the Chrome console to edit and run JavaScript - Quora
Answer (1 of 2): You can enter and run any JS you want in the chrome console as well as access global variables. For example, on this page right now, open the dev tools (F12 on Windows) and type: Date() and enter, and you’ll get the current ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-call-a-javascript-function-from-chrome-console
How to Call a JavaScript Function from Chrome Console ? - GeeksforGeeks
July 23, 2025 - We will learn how can we call the function in the console that is written in JavaScript. You can open the Chrome Console by right-clicking on your webpage, selecting "Inspect" from the context menu, and then clicking on the "Console" tab.
🌐
GitHub
github.com › GoogleChrome › developer.chrome.com › blob › main › site › en › docs › devtools › console › javascript › index.md
developer.chrome.com/site/en/docs/devtools/console/javascript/index.md at main · GoogleChrome/developer.chrome.com
When you physically follow along, you're more likely to remember the workflows later. Press Command+Option+J (Mac) or Control+Shift+J (Windows, Linux, ChromeOS) to open the Console, right here on this very page.
Author   GoogleChrome
🌐
Codecademy
codecademy.com › article › running-javascript-in-the-browser-console
Running JavaScript in the Browser Console | Codecademy
Google Chrome · Mac · Cmd + Opt + J · View > Developer > JavaScript Console · Windows · Ctrl + Shift + J · Customize and control Google Chrome (3-vertical-dot icon ⋮) > More tools > Developer tools, then click Console tab · Mozilla ...