I have a question regarding JavaScript and the methods by which its code can be run. As we know, there is JavaScript code embedded in tags, and it runs from the inside in a browser window - this is quite often how web pages work.
If we want to interact out of the box with the webpage we are surfing, we should use a tool like GreaseMonkey and write our UserScripts that will allow us to change the behavior of the page to what we want. It is still necessary that we open a browser window and visit our target.
Question: can we somehow run JavaScript code on a specific page without even opening a browser window? I mean, in an ideal solution, there is a command line tool that allows us to call:
./clibrowser http://google.com userscript.js
In which script, for example, we could run some AJAX code to retrieve the data coming from the requests, and transfer it to another PHP script that will store it in the database.
I think this question simplifies: Are there tools like a command line browser with a JavaScript engine? I know this may seem strange, but I'm only curious about the idea that I have in mind.
source
share