Solved

Break Out of IFRAME when URL changes

Posted on 2008-10-13
7
443 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now