Solved

Break Out of IFRAME when URL changes

Posted on 2008-10-13
7
446 Views
Last Modified: 2012-05-05
I'm framing in a portion of anotherwebsite.com on mywebsite.com/page (urls are just for example), which looks just fine and gives me the desired result I'm looking for. However, when someone clicks on a link inside the IFRAME the content inside the IFRAME will change to something like anotherwebsite.com/contactus, but I will not want these other pages to be embedded inside the IFRAME. I would like to have the user broken out of the IFRAME somehow into a pop up window with the full URL or just have the browser load the new URL. Is there anyway to detect this URL change and break the user out of the IFRAME? The website embedded in the IFRAME is not mine, so I don't have control over the content or code behind the site. Thanks.
0
Comment
Question by:sivle
  • 2
  • 2
  • 2
7 Comments
 
LVL 13

Expert Comment

by:Brum07
ID: 22702912
0
 

Author Comment

by:sivle
ID: 22702978
Thanks, but that tells you how to prevent your site from being included inside an IFRAME. In other words, it is used to automatically break your own site out of an IFRAME that someone else is trying to include your site in. I'm embedding someone else's page inside of my IFRAME and want to break them out when the URL changes. Different scenario.
0
 
LVL 13

Expert Comment

by:Brum07
ID: 22703001
Sorry mis-read the question.
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 82

Accepted Solution

by:
hielo earned 200 total points
ID: 22703418
For you to achieve what you seek, you need to do so from the page contained within the iframe. If you do not have access to the page within the iframe, then the browser will not let you do what you want since it is cross-site scripting, which the browser's do not allow for security reasons.
0
 

Author Comment

by:sivle
ID: 22704653
I think i've seen similar things done with Javascript...perhaps I need to move this question to that area for help. Thanks for the feedback.
0
 
LVL 82

Expert Comment

by:hielo
ID: 22704777
sivle, it seems to me your request was very clear, and my response is correct. Even though you posted this under Scripting languages, you will still get the same answer if you post this under Javascript, after all, javascript IS also a scripting language. The "solution" you seek is NOT dependent on any scripting language. The "solution" depends on whether or NOT you have control over the page within the iframe. Javascript or not, the limitation to what you seek is the security restriction imposed by the browser, not the scripting language you use.

http://www.experts-exchange.com/help.jsp#hi405
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question