Redirect website domain (including all pages) to external URL after Popup message (few seconds)

by Nisarg   Last Updated May 15, 2019 20:08 PM

I am new to wordpress and I have made custom code as below. Where I can place this custom code in wordpress. I want to redirect the website domain and all pages but wanted to display popup message for few seconds (3 to 5) and automatically redirect to any external URL.

<script type="text/javascript">   
    function Redirect() 
    {  
        window.location="https://example.com"; 
    } 
     $(window).on('load',function(){
        $('#myModal').modal('show'); 
        setTimeout('Redirect()', 5000);  
    });
</script>

<div class="container">
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Beaumondevillas are part of Natural Retreats</h4>
        </div>
        <div class="modal-body">
          <p>We are redirecting the Natural Retreats Palm Spring Page</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>

    </div>
  </div>

</div>


Related Questions


Updated June 29, 2019 17:08 PM

Updated September 04, 2018 23:08 PM

Updated March 27, 2015 13:02 PM

Updated May 25, 2017 02:08 AM

Updated February 27, 2016 01:03 AM