HTML: At the Mercy of the Iframe
Greetings,
I would sure apprecaite if anyone had any ideas on this.
To take a look at the issue, go to http://www.spcanywhere.com/enterprise_test.html, and click on an "Add to Cart" button. Then, in the shopping cart, click the "Continue Shopping" button, and you will see what is happening. The products.html page, accessed by the "Continue Shopping" button, is confined to the iframe on the right side of our page.
Are there any tricks, using javascript, or something; where I can bust out of the iframe, and have our products.html frame take up the whole window? (while retaining the contents of the shopping cart).
For the "Continue Shopping" button, I can only provide a link. I cannot provide any code to go with it, as it is a link I am merely providing to our shopping cart service, for their code to associate with the button.
Some background:
We have a comprehensive website already developed, that has several different separate product pages. The page accessed above is just a test template for one of our product pages.
The website, as it runs right now, makes use of a third party shopping cart system, that it calls.
When the shopping cart is presently called on the web site we are now using, a whole new Window, with the Shopping Cart, appears.
We need to integrate the shopping cart into our website (like in the link I provided), rather than having a whole new Window appear (as it is presently doing).
So, what we are doing, is making use of scripts provided by the Shopping Cart company, for the express purpose of integrating the shopping cart into our website.
It works great (as you can see), as the user will click on and "Add to Cart" button on our site, and the Shopping Cart pops up in an iframe on the right side of the page.
When they press the "Continue Shopping" button from within the shopping cart, we have the button call our products.html page, so that they can, from there, continue to shop around on our site for any of our other products.
The problem is, this product.html page, is confined to the iframe that the shopping cart is confined to on the page. We need it to cancel the whole window, and starting up fresh on our products.html page. (And keep the contents of the shopping cart, intact).
I realize that is the nature of iframes; but at the same time, are there any ideas for how I can resolve this issue?
For instance, can I have the "Continue Shopping" button (which I can only provide a link for) call a page that would have some javascript or vbscript that would command the whole window, not just the iframe, be replaced by the products.html page?
Thank you,
Jim
Re: HTML: At the Mercy of the Iframe
Where you are calling "document.forms" you might try "parent.document.forms" but you're probably going to get a permissions error...
Replacing your onclick event with "top.location.replace('http://www.spcanywhere.com/products.html')" should work tho..
Re: HTML: At the Mercy of the Iframe
Quote:
Replacing your onclick event with "top.location.replace('http://www.spcanywhere.com/products.html')" should work tho..
That's the problem. Becasue I can only supply the link to the shopping cart company, it doesn't understand stuff like
"top.location.replace('http://www.spcanywhere.com/products.html')".
It will only take a link in the format of http://www.spcanywhere.com/products.html
If I controlled the code behind the "Continue Shopping" button, I would be in great shape; but I don't.
This whole thing has me wondering if iframes is really the way to go, with trying to integrate an outside shopping cart into an already-existing website.
Maybe I'll have to re-think the whole approcah I should take this weekend.
If anyone has any ideas, regrading this type of situation, please let me know.
Thank you,
Jim
Re: HTML: At the Mercy of the Iframe
Oh..sorry that I missed the point about you not having control over all of the code. Putting this javascript in your page should break out of the iframe but your users will probably see the iframe load and then see the break out.
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (window != top) top.location.href = location.href;
// End -->
</SCRIPT>
Alternately, you could provide the shopping cart with a link which goes to a page like:
Code:
<html><head>
<script language=javasript>
top.location.href = 'url here'
</script>
</head></html>
You could also use a cgi script to generate the above output which would provide you with the ability to designate the destination page on the fly.....