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.
netviper2008Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Refael AckermannCommented:
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

0
Pawel WitkowskiSenior Javascript DeveloperCommented:
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.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

ZvonkoSystems architectCommented:
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

0
Pawel WitkowskiSenior Javascript DeveloperCommented:
Hmm Zvonko I have completly no idea how this could help netviper :))
0
netviper2008Author Commented:
Is there a JS solution vs using ASP?
0
ZvonkoSystems architectCommented:
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...
0
netviper2008Author Commented:
Zvonko,

What you did doesn't work.  Try it yourself.
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
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).
0
ZvonkoSystems architectCommented:
Of course it did not work because I change the URL from 1st to 2nd!

0
ZvonkoSystems architectCommented:
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>


0
scrathcyboyCommented:
" 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.
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
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...
0
netviper2008Author Commented:
wilq32,

I don't have an ASP server to try it on, only PHP. :(
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
For PHP check CURL function, it is very simple to use and you will achieve what you want (i think :>)
0
scrathcyboyCommented:
"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."

You cannot do this.  If that code cannot be removed from the page, it will ALWAYS POP OUT to the main page level -- this is the breakout code to break a page out of any frame, iframe, or any other page-level container.  The only way to defeat this and get the page to stay in a frame is to remove the code.  I think I already told you this, and the facts have not changed in the mean time.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
netviper2008Author Commented:
It looks like the solution is there is no solution.  Thanks for everyones help.
0
Pawel WitkowskiSenior Javascript DeveloperCommented:
how this answer is better than other answers ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.