Change iframe url using javascript

If you want to change the iframe url from the iframe window, you can use this small function to change the url of the iframe.

<script type=”text/javascript”>
$(document).ready(function() {
function() {
return false;

Explanation of the above script

  • clickToClose is the ID of the html tag by which you want to change the url after clicking on this.
  • window.parent is used to get the frame of the parent window to change the url.
  • frames[“myframe”] is the name of the iframe.

Bansal Sumit

To seek challenging roles and to achieve excellence in the field of Open Source Web Technology with a profound spirit of commitment and dedication.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *