UncleCoder.com

UncleCoder.com

Free programming examples and instructions

Redirect url in javascript

Demo and Code for how to redirect url in javascript

by Athil


Posted on 15 Jun 2017 Category: Javascript Views: 270

Edited on 16 Jun 2017



DEMO

Hi Here I am going to show how to redirect URL using javascript

Syntax

window.location = url;

Example 

window.location = "https://www.google.com";

Full Demo Code

 <div id="add" style="margin-top:200px;">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
   
<!-- DemoBanner1 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:970px;height:90px"
     data-ad-client="ca-pub-5750437455820212"
     data-ad-slot="4021804683"></ins>
<script>
    (adsbygoogle = window.adsbygoogle || []).push({});
</script><br/>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- demobanner2 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:970px;height:90px"
     data-ad-client="ca-pub-5750437455820212"
     data-ad-slot="5498537881"></ins>
<script>
    (adsbygoogle = window.adsbygoogle || []).push({});
</script>
        </div>

 



Leave a Comment:


Advertisement