urlautolink

Auto Link after idle on several times


I've read a thread and it's help me a bit, https://stackoverflow.com/a/4644315/4910669.

<script>
 var time = new Date().getTime();
 $(document.body).bind("mousemove keypress", function(e) {
     time = new Date().getTime();
 });

 function refresh() {
     if(new Date().getTime() - time >= 60000) 
         window.location.reload(true);
     else 
         setTimeout(refresh, 10000);
 }

 setTimeout(refresh, 10000);

But anyone can help me if I need to linked or href it to my homepage, ex :

<?php echo base_url(); ?>

Solution

  • You should set the location you need to refresh in the JS:

    Instead of this:

    window.location.reload(true);

    Change it to:

    window.location.assign(<?php echo base_url(); ?> /*or any URL*/);