I am working on a site which has an iFrame to display most of the sites content.
I have a link on the home page that opens a page that DOES NOT have an iFrame to display the content, but it does have buttons which link back to the home page.
HOME BUTTON, loads the home page which includes the iFrame, it loads the default content. That work as required.
PRICE BUTTON, loads the home page as expected with the default iFrame content.
Is it possible to click the PRICE BUTTON, load the home page and the iFrame containing the price page within the iFrame.
Any help would be great, many thanks.
Keep safe and well.
Yes. You can do almost anything you want with iframes...
To do what you request can be done in two ways...
If the PRICE button is actually on the home page, just name the iframe and target it.
Let's suppose you have 2 pages:
1.) home.html (The parent frame)
2.) price.htm (The daughter iFrame, or internal frame)
This little script makes your price.htm page ALWAYS open in the parent window... in this case, home.html:
Add the above snippet of script to the head of the page named: price.htm
Make your hyperlink to price.htm - it will always open inside of home.html
Here is a demo:
PS- I have developed my own convention for naming files inside and outside of iFrames... I use .htm so I know if a file is an internal frame and always put the above code in it so it cannot open without the parent - otherwise I use the extension .html. Then if I have a lot of files in the same folder, I can tell which are internal iframes and which are not at a simple glance.
Last edited by donatello; 11-28-2009 at
Reason: clarification of example...
Users Browsing this Thread
There are currently 1 users browsing this thread.
(0 members and 1 guests)