Jump to content

Timeout On Javascript


private_guy

Recommended Posts

Hi there,

 

I'm trying to add a timeout to the below JavaScript from Zango but its not working. Here is the orginal source:

<html>
<!-- POG START --> 
<script type="text/javascript" language="javascript" src="http://prompt.zangocash.com/pog/0121a9eeb5.js"></script> 
<script language="javascript" type="text/javascript">self.focus();</script> 
<!-- POG END -->
</html>

 

And I tried to mess with the scr code and added timeout which looks like this:

    <html>
<!-- POG START --> 
<script type="text/javascript" language="javascript" src="setTimeout(http://prompt.zangocash.com/pog/0121a9eeb5.js)3000"></script> 
<script language="javascript" type="text/javascript">self.focus();</script> 
<!-- POG END -->
</html>

 

But didn't work, How can I put a timeout script on this?

 

Many Thanks.

 

Best Regards,

Jay

Link to comment
Share on other sites

  • 2 weeks later...

No, you can't do that.  PHP executes on the server before anything is sent to the browser.

 

The timeout has to occur on the client.  But I have to wonder if theres not a different way to solve your problem.  It seems odd that the advertising script would mess up your layout.  Are you sure you're using it correctly?

Link to comment
Share on other sites

You can do something like this instead

<script language="javascript">
function LoadScript(url){
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e); 
}

setTimeout("LoadScript('http://prompt.zangocash.com/pog/0121a9eeb5.js')", 3000);
</script>

 

This will load the script after 3 seconds.

Link to comment
Share on other sites

There is no Self.Focus in that code, so I dont think it will work, I will test it now.

 

Hmm.. Well I cant think of another way, Yes it messes up my Layout because if it loads before, the boarder should change White to show, but it doesn't. If you have a fast connection, its no problem, but if you have a slow connection, it will mess up the boarder.

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.