Hi to all, I'm developing a web page and the requirements is that the page must include an iframe and the user can insert an URL address and the page will be displayed in the iframe(I write awhile a question displaying contents ion iframe and I receive an answer the I should write my own pages), this is the requirement I receive so I have to do it this way.
My Problems:
1. There are pages the run a code like:

top.MyFunctio();

Because now the top is one of my pages and in the page doesn't exist the "MyFunction" method I receive javascript errors, I was wandering if there is way to catch all the errors they come from the iframe?
2. I have a page that has an iframe and it shows a page in it. Now, I am having trouble stop users such that if they click on a link that will force to take over the entire IE, I loose my webpage completely.
For e.g. Iframe pointing to "www.yahoo.com", if you click on any link on the iframe that is displaying yahoo.com, you will see that the entire page will now be directed to yahoo.com and I have lost my page.
Is there a way this can be done. What I want is that the user should be able to navigate to any page they want under yahoo, but they all should still be displayed in that iframe.
Any help will be highly appreciated
I noticed that some pages are using the following code:

page=self.location.href; 
if(page!=top.location.href) 
top.location.href=page;

Anyone, any suggestion will be more than welcome
Thanks

sites put a framebreaker in their page to stop thieves.
it appears they are stopping you, follow the logic.
Using someone elses page as (or in) your own without permission is theft, you are using their resources, and server as your own.

Write your own pages
contact the site owner and license their content
open the page in another browser window/tab, with a note "Opens in New tab, close the tab to return to mysite.com"
or accept that "Your" page is going to be seized by the person who actually wrote it.

suggesting that the uri is being entered by the user, is no defence, you are creating the code that inserts the page in your site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.