IFrame
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>IFrame Title</title> <script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { window.top.location.href = 'https://pritomkumar.blogspot.com'; }); }); </script> </head> <body> <button type="button">Reload IFrame Parent</button> </body> </html>
To modify your iframe embed code, you will add the following attribute inside the opening iframe tag:
sandbox="allow-top-navigation allow-scripts allow-forms"
Container of IFrame
<style type="text/css"> iframe { width: 40%; height: 95%; margin-left: calc(30%); border: 1px solid lightgray; } </style> <div> <iframe src="iframe-html.php" sandbox="allow-top-navigation allow-scripts allow-forms"></iframe> </div>