Web Analytics Made Easy -
StatCounter Function call after redirect? - CodingForum

Announcement

Collapse
No announcement yet.

Function call after redirect?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Function call after redirect?

    I have a link in one page and want after click to be redirected to other one and call javascript function from the second page. How to do this?
    I've tried with setTimeout() but doesn't work for/because of me.

    Code:
     function redirect(){
       setTimeout("someJSfromSomething()",5000);
       window.location=something;
    }
    Thanks in advance!

  • #2
    Not possible. Once the redirect has taken place the previous page and its scripts are destroyed.


    BTW, the time to say "thanks" is afterwards, not beforehand which gives the impression that you take other people's unpaid assistance for granted. Or as British politician Neil Kinnock put it, "Don't belch before you have had the meal." Prefer to use "please" beforehand and if you find a response helpful then you can use the "Thank User For This Post" button.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

    Comment


    • #3
      Originally posted by Philip M View Post
      .. which gives the impression that you take other people's unpaid assistance for granted.
      The thanks are for spended time on the issue
      "Words are treacherous weapon" -Me

      Comment

      Working...
      X