Link to home
Start Free TrialLog in
Avatar of netviper2008
netviper2008

asked on

stop redirect in Iframe

Hi all,

I am working on something for a client, but I cannot figure it out and I need help.

I am trying to use an iframe to place this page http://brunswick.1st-place.com/res/ils_frames.cfm    into another page and then put ads etc around it.  As soon as I try, it automatically forwards the site to that page.  My understanding it happens because it has a js on it.

<script language="javascript">
<!--Hide from older browsers
if (top.location != location) top.location.href = location.href;
// -->
</script>

I asked them if they could remove it, but they said they couldn't -- however, they gave us permission to frame the site.  I am not sure how to do it and I need help.   I read some things on this site, but couldn't get any of them to work.

Thanks for your help.
Avatar of Refael Ackermann
Refael Ackermann
Flag of United States of America image

Off the top of my head, it might not work, but you could try to "hide" your window's location object.
On your page write:

window.origLocation = window.location
window.location = {}

Open in new window

Oh man, this is a script for preventing anyone to put site into iframe, and from what I know there is no know solution to bypass this. This is needed by lot of sites because of security polices. Imagine that you have login page, and someone make a page that iframes your page, and in place that you have login box they put they own logging box (outside of iframe). So instead of typing data in your page they can steal this informaction! Thats serious problem so on web there are script like this to prevent this happens.
Avatar of Zvonko
I have a solution for you netviper2008:
<HEAD>
<TITLE>Zvonko &#42;</TITLE>
</HEAD>
<FRAMESET ROWS="70,*" FRAMEBORDER="0" FRAMESPACING="0" BORDER="0">
	<FRAME SRC="http://brunswick.2nd-place.com/res/ils_top.cfm" NAME="1stPlaceILSframeset" SCROLLING="NO" NORESIZE>
	<FRAME SRC="http://brunswick.2nd-place.com/res/ils_map.cfm" NAME="botframe">
</FRAMESET>
</HTML>

Open in new window

Hmm Zvonko I have completly no idea how this could help netviper :))
Avatar of netviper2008
netviper2008

ASKER

Is there a JS solution vs using ASP?
You need no JS and no ASP to add the frames to your page. Simply make YOUR frameset like I did.
If you still have no idea then ask. But I am assuming that my example is selfexplaining...
Zvonko,

What you did doesn't work.  Try it yourself.
Zvonko are  you sure that you read this question precisely ?:)

netviper.. Only one sollution I think about now is to use server side script that will download page and cut off javascript that breaks iframe. (something like written in ASP).
Of course it did not work because I change the URL from 1st to 2nd!

Sorry, I did not test it. I have removed the script from frameset.
But the frame named botframe is doing frame chaking and set the cookie VALIDFRAMESET on ColdFusion server side.
If it does not get that cooki then it responds with only this page content:
      <SCRIPT LANGUAGE="JavaScript">
      top.location.href='http://Brunswick.1st-place.com/misc/breakframes.cfm';
      </SCRIPT>


" however, they gave us permission to frame the site."

If they gave you specific permission to "frame the site" then simply clone that site setup to your own site, remove the code you listed that breaks out of any frame or iframe, and put YOUR redone code into your site in the iframe -- this assumes you have their permission to do it.  If you can't do that, you will NEVER defeat the code specifically designed to break the site out of any iframe or frame -- you must remove that code.
netviper as I told you before, there is no known pure javascript solution for that. You need some server side scripting to achieve that. Check link that I gave you...
wilq32,

I don't have an ASP server to try it on, only PHP. :(
For PHP check CURL function, it is very simple to use and you will achieve what you want (i think :>)
ASKER CERTIFIED SOLUTION
Avatar of scrathcyboy
scrathcyboy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It looks like the solution is there is no solution.  Thanks for everyones help.
how this answer is better than other answers ?