Search code examples
javascriptphpjqueryhttp-redirectvisitors

Redirect A Live Website Visitor Without Them Refreshing or Clicking anything?


I am hoping someone in the community can either tell me I am off my rocker, or that this is possible.

The objective example; Someone is presently on a webpage, viewing the content and/or watching a video. Let's say it's index.php, but we want them to be on view.php. We click or save the php code and the page automatically moves the visitor.

Presently, we can do this within WebinarJam, our live webinars (google hangouts) we just click a button inside the app hosting in the hangout and it redirects all the webinar attendees to another page, via opening a tab.

Is it possible to do this while someone is on your webpage ? I have search around and can't figure out if it is, or if I am just search for the wrong keywords.

Assuming you could create a "listener" to check every few seconds, I would think it would be possibles. Again, I am not an amazing coder like most who are within this community.

Appreciate the comments and information.


Solution

  • I think I would do it with using jquery like this...

    <script>
    var stuff="{'webnair':'1'}";
    var move = 0;
    $('body').on('click',function(){
        if(move){
         $.post('add.php',{stuff: stuff},function(data,status){
             if(status=='success'){alert('Done');}
         });
        }
    });