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.

Share This Post

Post Comment