Introduction
Being able to embed a web page in another web page can be really handy. Also source page of iframe can be modified which means that programmers can update the embedded page content.
Issue
The problem with iframe tag is that when users click on the browsers back button, the embedded page goes one page back instead of the main page if the source URL of the iframe has been dynamically changed. This behavior is not acceptable in some situations.
Resolution
Use the follow JavaScript code in order to change the iframe source URL:
top.frames['Iframe Name'].location.replace("New URL");
Iframe Name is the name of iframe tag. Please note that it is not the iframe Id.
New URL is a placeholder for the URL name.
It works in both IE and FireFox.
No comments:
Post a Comment