Reputation: 35
Can i make working javascript without open browser or still working after close browser ? Example :
setTimeout(function(){
test();
},86400000;
setTimeout still working after close browser
Upvotes: 1
Views: 249
Reputation: 228
JavaScript can be run by any interpreter for JavaScript such as the windows script host or node.js runtime environment. But those are different environments with different global scope. For example, using windows, you can save a .js-file from a webapp to the desktop and try to run it. The windows script host will run it but likely fail because it does not have the same objects in its global scope that browsers use.
A script executed inside a browser will always terminate with the browser as the browser is the process executing the script. The script itself isn't in a native executable format and, thus, can't be run by the OS itself instead it requires the browser to interpret the code.
Upvotes: 1