I am new to javascript and I am using the code below to open a browser window and do some things. However, when I open multiple files simultaneously, it just opens a new tab in the existing browser window, but I want it to open in a new window (preferably incognito mode if possible). Based on my research, I'm thinking I can just modify the if
statement, but I'm not sure how.
<html>
<body onload="window.setTimeout('document.getElementById(\'criimlaunch\').click();', 1000);">
<script>
var macroCode = '';
macroCode += 'PROMPT HELLO!\n';
function launchMacro()
{
try
{
if(!/^(?:chrome|https?|file)/.test(location))
{
alert('iMacros: Open webpage to run a macro.');
return;
}
var macro = {};
macro.source = macroCode;
macro.name = 'EmbeddedMacro';
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent('iMacrosRunMacro', true, true, macro);
window.dispatchEvent(evt);
}
catch(e)
{
alert('iMacros Bookmarklet error: '+e.toString());
};
}
</script>
<a id="criimlaunch" href="javascript:launchMacro();">Launch iMacros</a>
</body>
</html>