Link to home
Start Free TrialLog in
Avatar of justfurious2k3
justfurious2k3

asked on

stop Iframe Redirect

ok so here is the thing... i have been looking over the site and i can't find the answer anywhere.  I am building a site in html, the site is for someone with an ebay store.  within their site, i used and Iframe to show their store instead of a link.  when it goes to that page, you only see it in the frame for about 2 seconds, then ebay takes it over, and the whole page gets redirected to the store.  you can't even go back to the website.  here is the code i am using.... <IFRAME name=ebay src="http://stores.ebay.com/BACKDROP-OUTLET" width=800 height=600
> content
 if browser does not support </IFRAME>

I need it to STAY in the frame and not leave the site.... I don't even know if what I am trying is possible.
please help as this is sooooooooooo important.  thanks
Avatar of nschafer
nschafer
Flag of United States of America image

Hi justfurious2k3,

The most likely reason for the results you are getting is that the store has a frame-busting script built into it.  Glancing quickly through the source for the page I don't see it, but since there are a few external scripts being called it could be in one of them.  It is difficult to get around this.  The whole point of frame-busting is to prevent exactly what you are trying to do.  

If you look at the following question it may give you a start on how to do this.

https://www.experts-exchange.com/questions/21707999/Disabling-frame-busting-script.html

Hope this helps,
Neal.
Avatar of justfurious2k3
justfurious2k3

ASKER

i want you to know i have already discussed this WITH ebay and they told me that if i could find a way to do it, it's ok but they couldn't help me.  at any rate.. I am not the biggest programmer.  from your link I found a code i think you are saying can help.  this is what i have...

frameshow.html
--------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Show page in frame</title>
<script type=text/javascript>
function getPage(){
  window.frames[0].location = "frameshow.asp?url=" + document.getElementById('url').value;
}
</script>
</head>
<body>
<input type=text id="url" size=50/>
<input type=button onclick="getPage()" value="Get Page" />
<iframe name="i1" id="i1" width="100%" height="400" src="about:blank"></iframe>
</body>
</html>

my question for this is I don't see where I would be putting in the store url.  I mean i see some url spots but does it go where ever i see "url"?  thanks!
justfurious2k3,

The question that I pointed to had a couple of things going on differently than yours.  Specifically the URL was being entered by the user.  In your case you will want to hard code the URL.

  window.frames[0].location = "frameshow.asp?url=http://stores.ebay.com/BACKDROP-OUTLET";

The other things to keep in mind, as I had mentioned in that post.  The method used is to use an ASP page to strip out the Scripts.  This could be done without ASP, but the code at the question I pointed to uses ASP, so make sure you have the ability to process ASP pages.  If not, this can be re-written to not require it.

What might be a bit of a larger problem for you though is that the idea here is to remove all scripts from the page before showing it in the frame.  This might be a problem for you because you likely need some of those scripts for the store to work properly.  We may be able to be more selective in removing the scripts, but it will take a bit of work to look at the running code and determine how to properly eliminate only the frame-busting script.

Neal.
Neil you are really informative and i appreciate it!! thanks!  now is there anyway you can give me an example of the exact code I would need to put in?  thanks again you rock

Dutch
neal,  I was using the wrong ebay store and I apologize.  here is the new frame HTML i am trying to use

<IFRAME name=ebay src="http://stores.ebay.com/Decorative-Fabric-Outlet"
 width=800 height=600> content if browser does not support </IFRAME
>

i am soo sorry about that but this is THE store we are trying to do it on...  thanks again!
ASKER CERTIFIED SOLUTION
Avatar of nschafer
nschafer
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
NEAL!!!!! You are the coolest!  thank you sooo much.  I have already posted it and you can look at it at www.truspecmedia.com/fabric.html also i was wondering though, withing the ebay page i see some things like "-->"  is that because some code was stripped?  thanks you rock!!!!!!!!!

Dutch
ok wait one more thing... if you go onto www.truspecmedia.com/fabric.html  and play around a little in the store (click contact or search something within store)  you will notice that it will bust out after a few clicks... anything we can do about that?  thanks!
I'm not sure why the "-->" is showing up, but it is possible that it's because the scripts look something like this:
  <script>
  <!--
   ....
   ....
  -->
  </script>

The code I added above would convert this like this:
  <!--<script>
  <!--
   ....
   ....
   -->
  </script> -->

What happens here is that it is commenting out the script.  Often scripts will have <!--   --> within the script to prevent the script from being displayed as text in old browsers that did not support scripting.  Since the --> ends the comment, the </script>--> are outside the comment area.  

I can't really think of a way off the top of my head to prevent this.  If the script does not have <!-- --> in it then this isn't a problem, but with it there this will occur.  

Perhaps a different method could be used rather than just commenting out the scripts they could be removed altogether.  Something along the line of this.

Instead of these lines:
   txt = replace(txt,"<script","<!--<script")
   txt = replace(txt,"</script>","</script>-->")

This might work:
nStart = instr(txt,"<script")
do while nStart > 0
  nStart = instr(txt,"<script")
  nEnd = instr(txt,"</script>")
  if nStart > 0 then
    txt = left(txt,nStart -1) & right(txt,len(txt)-nEnd -8)
  end if
loop
 
The problem with the page busting out of the frame is because the links embeded in the page don't go through the frameshow.asp page.  We might be able to do another replace, to replace the href's in the page, but the consistancy of the formating of the code for the links might be a problem.

Neal.
Neal,  I can not tell you how BIG of a help you have been.  Please know how much i appreciate you working on this.  I am even willing to throw you some of my comission if it would help you.  do you think it is even possible to pull this off?  I know it is difficult but i would appreciate anything you could do to help me keep this in the frame no matter what is clicked within it.  thanks so much!

Dutch
ok another message, is there anything we CAN do about the consistency of the code?  i mean keeping it straight through so ebay stays within the fram 100%?  like i said i am willing to give you some of my comission if we can do this.  thanks again for all your effort!
Dutch,

Thanks for the offer, but paying for results would be against the policies of this site.  It could  also potentially open me to some liability.  The experts here are all volunteers and we provide no gurantees that our solutions will work (although we certainly try).  Once money changes hands things can get a bit more difficult.  But as I say, thankyou for the offer.

I've looked at the code and it appears that ebay is very consistant in how they put in the hyperlinks.  I put some code in to replace the hyperlinks with a call back to the frameshow.asp page.  The script was successful at changing the hyperlinks, however a problem I hadn't thought of came up.  By going through the frameshow.asp page we are working across domains (your domain and ebay's domain)  As soon as I clicked on one of the links I received an access denied error.  Offhand I can not think of a solution for this.  This is a basic security issue that has been built into browsers / web-servers.

I'm not going to say that this would be completely impossible, but I don't see a solid solution at this point.

By the way I used the code I posted above to remove the scripts instead of commenting them out and this did work, but we still have the problem that it is only good for the first page.

Neal.
BIG OOPS ON MY PART!!!  i don't want to go against the policies (remembe i'm still new to this site)  i totally understand everything you are saying... thanks so much for all the help.  I can't tell you how much appreciate it!

Dutch
No problem.  I wish I could think of a way around it breaking out of the frame (the sign-in page is where I noticed it) but frankly I just can't seem to think of anything that will do it.

Neal.