Redirecting Parent Window from an Iframe
If you want to redirect the parent window from within an iframe, you can achieve this using JavaScript. Here's how:
Window.top.location.href
To redirect the topmost parent iframe, use the following code:
window.top.location.href = "http://www.example.com";
Window.parent.location.href
To redirect the direct parent iframe, use this code instead:
window.parent.location.href = "http://www.example.com";
These JavaScript snippets effectively redirect the parent window from an iframe action, allowing you to control the navigation of the parent window from within the child iframe.
The above is the detailed content of How to Redirect the Parent Window from an Iframe using JavaScript?. For more information, please follow other related articles on the PHP Chinese website!