Inject JavaScript code into Google Chrome browser when opening a page via command line/batch file


Alberto Del Villano

I have a command that runs through a batch file

chrome.exe --app=https://www.stackoverflow.com/

I want to run a script (e.g. increase font size) after opening the page via batch file

Is that possible?

Red

You can script Internet Explorer using Windows Script Host ( example ) , but not other browsers . After launching Chrome, you need to send keystrokes to operate Chrome (eg:SendKeys

powershell "$sh = new-object -COM Wscript.Shell; $sh.AppActivate('Chrome'); $sh.sendkeys(\"^^{+}\")"

...to increase the font size), or use TamperMonkey to load user scripts from the browser side.

Related


When opening the html file on the browser, I see the source code

username I'm trying to open a basic "hello world" html file on a browser (chrome/explorer). However, the browser will display the code itself instead of the expected result. What could be the problem? Code: <!DOCTYPE html> <html> <head> <title>Hello, Wor

When opening the html file on the browser, I see the source code

username I'm trying to open a basic "hello world" html file on a browser (chrome/explorer). However, the browser will display the code itself instead of the expected result. What could be the problem? Code: <!DOCTYPE html> <html> <head> <title>Hello, Wor

How to inject JavaScript code to refresh the page periodically

Meow Destroyer I have a normal HTML file and I want to call it via JxBrowser (backend Java). JxBrowser allows you to add JavaScript code by: // Java code Browser browser = new Browser(...); browser.loadURL(...); ... String test = "setTimeout(function() { aler

How to inject JavaScript code to refresh the page periodically

Meow Destroyer I have a normal HTML file and I want to call it via JxBrowser (backend Java). JxBrowser allows you to add JavaScript code by: // Java code Browser browser = new Browser(...); browser.loadURL(...); ... String test = "setTimeout(function() { aler