Created
October 18, 2020 01:40
-
-
Save enishant/6dd6b5b74de1dada023b2f677a43b621 to your computer and use it in GitHub Desktop.
Connect / Disconnect internet (for changing IP address) and open URL and exit it (written for iBall Baton)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myWindow; | |
function connectInternet() { | |
var mainFrame = document.getElementsByName('mainFrame'); | |
var childFrame = mainFrame[0].contentDocument; | |
childFrame.getElementById('Connect').click(); | |
} | |
function disconnectInternet() { | |
var mainFrame = document.getElementsByName('mainFrame'); | |
var childFrame = mainFrame[0].contentDocument; | |
childFrame.getElementById('Disconnect').click(); | |
} | |
function openBrowserWindow() { | |
myWindow = window.open("https://www.example.com", "_blank"); | |
myWindow.focus() | |
} | |
function closeBrowserWindow() { | |
myWindow.close(); | |
} | |
function loopBrowserView() { | |
connectInternet(); | |
setTimeout(function(){ | |
openBrowserWindow(); | |
setTimeout(function(){ | |
closeBrowserWindow(); | |
disconnectInternet(); | |
},20000); | |
},5000); | |
} | |
disconnectInternet(); | |
setInterval(loopBrowserView, 30000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment