force external page into iframe?

J

jshanman

If I try to put a site into an iframe that has "escape frame" code in
its source (posted below), it will reload the requested page into the
parent instead of the iframe. Is there a way to prevent this from
happening?

One could use onunload to stop the redirection, but I would like to
find a way to load a page into an iframe, even if it has this type of
code.

I have considered server code loading the content and re-displaying it
but I would like to find a pre javascript solution.

//this is not my code
if (self != top) {
if (document.images) {
top.location.replace(window.location.href);
} else {
top.location.href = window.location.href;
}
}

BTW: This is not with malicious intent...

- JS
 
D

David Dorward

jshanman said:
If I try to put a site into an iframe that has "escape frame" code in
its source (posted below), it will reload the requested page into the
parent instead of the iframe. Is there a way to prevent this from
happening?

No. Otherwise there wouldn't be a lot of point in the author having the
frame escape code.
 
R

Randy Webb

jshanman said the following on 4/27/2006 11:42 AM:
If I try to put a site into an iframe that has "escape frame" code in
its source (posted below), it will reload the requested page into the
parent instead of the iframe. Is there a way to prevent this from
happening?

Yes, you stop trying to Frame other peoples pages in your own page and
you don't have a problem anymore.
One could use onunload to stop the redirection, but I would like to
find a way to load a page into an iframe, even if it has this type of
code.

You think you can use onunload? Try again.
I have considered server code loading the content and re-displaying it
but I would like to find a pre javascript solution.

Go server code. Client side isn't going to happen.
 
J

jshanman

Randy said:
jshanman said the following on 4/27/2006 11:42 AM:

Yes, you stop trying to Frame other peoples pages in your own page and
you don't have a problem anymore.


You think you can use onunload? Try again.


Go server code. Client side isn't going to happen.

Thats what I thought.

FYI: This actually isn't something that I would ever do for myself, a
freelance project was posted with this as one of the requirements. I
was fairly sure it was impossible (using only javascript/iFrames), but
now I'm 100% sure! Thanks!

- JS
http://www.endeavorpub.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top