Let's say you have a script.
for example
Where clixdo is javascript for window.open( url + x + y )Code:// ==/UserScript== clix(); function clix() { //generate random number x = getRandomInt(1, 20) y = getRandomInt(1, 28); clixdo(x, y); } function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
How would you go about managing the windows, and properly closing them?
What about with a given time interval. (page needs to load another page and wait x time)
Given the code could be changed to new_window = window.open( some url ) and could be added to an array.
Results 1 to 6 of 6
- 20 Oct. 2014 10:29pm #1
- Join Date
- Apr. 2013
- Location
- Minnesota
- Posts
- 1,325
- Reputation
- 114
- LCash
- 0.00
Proper JavaScript Window Management?
https://discord.gg/TvN6xUb ~ chat on discord pls.
- 21 Oct. 2014 05:06pm #2
I'm not exactly sure what you're trying to do, but if you're trying to send web requests you could just use XML.
Code:function httpGet(theUrl) { var xmlHttp = null; xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", theUrl, false ); xmlHttp.send( null ); return xmlHttp.responseText; }
There's nothing ideal about being real, there's so many flaws to cover and conceal.
- 21 Oct. 2014 07:51pm #3
- Join Date
- Apr. 2013
- Location
- Minnesota
- Posts
- 1,325
- Reputation
- 114
- LCash
- 0.00
Thanks
I did learn something from your snippet there.
I'm not sure if it'll work through web-requests though, but it's worth a shot.
page has to load another and do an ad-timeout to be valid.https://discord.gg/TvN6xUb ~ chat on discord pls.
- 29 Oct. 2014 12:11am #4
I am pretty sure, but I may be wrong, that when you open a window, it returns a window object.
var myNewWindow = window.open("whatever")
To manage that window, you would use myNewWindow. You can store it in whatever variable or array of variables that you want.
I believe there are also window names that work something like:
window.open("url", "myWindowName")
such that you can reference:
window.myWindowName.close(), etc.
That markup may be incorrect, as I don't ever use windows ever. Popup blockers kinda killed the window.open() usefulness, and I don't oppose that.
- 29 Oct. 2014 12:28am #5
- Join Date
- Apr. 2013
- Location
- Minnesota
- Posts
- 1,325
- Reputation
- 114
- LCash
- 0.00
https://discord.gg/TvN6xUb ~ chat on discord pls.
- 29 Oct. 2014 02:12am #6
Where's the problem? You can have multiple windows. It just takes multiple variables or window names.
myWindows[myWindows.length] = window.open("etc")