Hi to all, I have the following problem:
I have a page that includes an iframe, this iframe is dynamic (meaning that I don't know what will be its source, user can insert any URL). The problem is that are some URLs that take over all over the site, I found that in the URL(pages) they are using the following code

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

They check if the top.location(the main page is not the same), if is not the same they override the location, the result of this code is that the page take over and the URL(page) is displayed in all the page and not only in the iframe.
I was wandering if there is a way to stop this, how I can know the page is going to take over?
Is there is a way to stop this?
This is driving me crazy...
I'll appreciative any help to solve this
Thanks in advanced :'(

its a framebreaker,
to reduce bandwidth theft, content theft
stop stealing other sites' content,
stop stealing other sites' bandwidth,
open pages in a new tab not in your iframe,
use their RSS feed if they provide one,
or contact the site owner and seek a licensing deal for their content.

Its just Javascript, there is nothing you can do to stop it without serious modification to the users browser or changing the source of the page. To quote from almostbob

stop stealing other sites' content,
stop stealing other sites' bandwidth,

If it was my site you were stealing from I would be really P***ed off with you. Just don't be so stupid and write your own content. Its called web DEVELOPMENT which implies that you actual develop something rather than just nicking other peoples stuff.

I hate that code too. because it destroys my browser history. Often I want to use the BACK button to get back to where I was before. Greedy sites that use such code prevent me from getting back.

samarudge: First at all I'm not trying to steal nothing from no one, this is the implementation I need to write, user can insert any URL and then I need to display it in the iframe. Actually I'm developing a whole web site and this is one of the request.

Well their is still nothing you can do to stop it, and whether your selecting the page to display in the frame or your users are you would still need permission to do this.

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.