Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
Hello,
I want to check http status code of URL using
GM.xmlHttpRequest
.Code: source
// url (instance) is selected from instList inst = instList[Math.floor(Math.random()*instList.length)]; name = inst.split(',')[0]; inst = inst.split(',')[1];
This is what I want to do:
while (status =! 200) { inst = instList[Math.floor(Math.random()*instList.length)]; inst = inst.split(',')[1]; // CHECK HTTP STATUS OF GIVEN URL ("inst") status = response.status }
Userscript https://openuserjs.org/scripts/sjehuda/FREEdirector
Below is my recent attempt, so far.
I'd appreciate your help with it.
Code:
while (toot < 5) { inst = instList[Math.floor(Math.random()*instList.length)]; inst = inst.split(',')[1]; toot = toot + 1 console.log('toot') console.log(toot) console.log('inst') console.log(inst) GM.xmlHttpRequest({ method: 'GET', mode: 'no-cors', url: inst, synchronous: true, onload: function(response) { status = response.status; console.log([ response.status, response.statusText, response.readyState, response.responseHeaders, response.responseText, response.finalUrl, responseXML ].join("\n")); } }) console.log('status') console.log(status) }
Output:
1 FREEdirector:572:11 inst FREEdirector:573:11 https://lieu.cblgh.org FREEdirector:574:11 status FREEdirector:593:11 undefined FREEdirector:594:11 toot FREEdirector:571:11 2 FREEdirector:572:11 inst FREEdirector:573:11 https://searx.be FREEdirector:574:11 status FREEdirector:593:11 undefined FREEdirector:594:11 toot FREEdirector:571:11 3 FREEdirector:572:11 inst FREEdirector:573:11 https://searx.rasp.fr FREEdirector:574:11 status FREEdirector:593:11 undefined FREEdirector:594:11 toot FREEdirector:571:11 4 FREEdirector:572:11 inst FREEdirector:573:11 https://85.199.74.98:8443 FREEdirector:574:11 status FREEdirector:593:11 undefined FREEdirector:594:11 toot FREEdirector:571:11 5 FREEdirector:572:11 inst FREEdirector:573:11 https://farside.link/searx FREEdirector:574:11 status FREEdirector:593:11 undefined FREEdirector:594:11 Redirecting to https://search.yacy.net/yacysearch.html?query=userscripts
Solved. Userscript has been updated.