Nice, yea that would work but I'm talking about a site being able to block a user from using it in a script. I wrote a script that pull info then adds a little back and everything works fine as long as I don't have setTimeout in the script. If I add it to the script it won't work, and I know how to use setTimeout pretty good, tested the script and it always falls back to the setTimeout which I think the sites blocking...
Philip: He means that ON THAT SITE, where he is dumping in his own JS code, they are suppressing setTimeout.
That would obviously be trivial to do if the user must supply his "site" code (including JS) as a text file that is then run by the site. They just mangle the code before allowing it to run. I *thought* he had implied that he is using a <script src="http://www.hissite.com/somecode.js">, but he didn't state that, so maybe I read too much into the post.
Hmmm...I guess even that wouldn't be too hard to mangle: They look for such "includes" and, instead of dumping them in directly, they pull them through their own filter.
That is, when they see
they mangle it into
If you have to deliver text to them, they can pretty much mangle your code as much as they want.
Yeah, I think that's got a good chance of working. Since they clearly *are* searching for text "setTimeout" maybe they'll miss that.
I know another sneaky way: Use AJAX (well, XMLHTTP) to hit a service that does nothing but wait a given time. Or hit an invalid URL, on purpose, after setting a specified timeout on the XMLHTTP object. Ehhh...but if they are blocking setTimeout, they are probably blocking XMLHTTP.
Whoa... go away for the weekend and comeback to tons of stuff lol. Thanks for all the posts and ideas so lets see if I can break it all down.
First I'm not going to mention the site because it's against their policy to use scripts (but everyone does). The site had some code changes lately so some of my codes where broken, they were easily fixed except one, the smallest one.
Yea I did get the native code so setTimeout is working, but I don't know why they'd block this and not anything else, though a lot of scripts use setTimeout. I tried you code but it still doesn't work.
I also think Philip M is on to something when saying that setTimeout is being called to fast, even when changing the time. I think the site is using this somehow to block it, though that is an opinion.
I'll have to keep testing different things. I tried adding a pause in the script but that just cause the script to crash....