Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using frames to load in a new page

Status
Not open for further replies.

alexanderdring

Technical User
Dec 27, 2002
36
FR
Hi everyone,

This is probably quite simple, but I have a single page in HTML with some content and a single button and I would like to use a frameset to replace the entire page with new content while keeping exactly the same URL in the address bar. Can anyone tell me how to do this? Thanks in advance.

Alex
 
To clarify, that would be: when you press the button, the page changes using frames! Thanks!
 
do you have an understanding of frames? do you currently have frames set up? please try to be more specific when asking questions - it's much easier for Clive to help when you do so.



*cLFlaVA
----------------------------
[tt]( <P> <B>)[sup]13[/sup] * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
If you want the URL to remain the same, you will either have to use client-side scripting to dynamically build a frameset, or use server-side scripting to output different content for the same URL.

It's been a while since I've clowned around with frames, but I'm pretty sure that's the case.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Although it makes my skin itch to do it... try this:

Make a frameset page
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en">
<head>
<title></title>
</head>
<frameset cols="100%">
	<frame src="page.html" name="main" scrolling="auto"  frameborder="0" />
	<noframes>
		<body>
		No Frames content here
		</body>
	</noframes>
</frameset>
</html>


Note that we set up the frameset with just 1 frame.

Load your pages into it, and specify links within them with the attribute target="main" like so:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>You will never see this - page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<p>This is called <b>page.html</b>, although your address bar will show the URL of the frameset it is loaded into.</p>
<p><a href="anotherpage.html" target="main">Load another page</a></p>
</body>
</html>

This way, the URL in the address bar will always show your frameset URL.

HOWEVER
Consider why you want to do this.
What is the benefit to your users in having a static URL in their address bar.
More importantly, consider the disadvantages to your users.

Foamcow Heavy Industries - Web design and ranting
Buy Languedoc wines in the UK
 
I don't think you'll need those [tt]target[/tt] attributes - if a page is being displayed inside a frame, any linked pages will be shown in the same frame unless you override it with a different [tt]target[/tt].

Agreed it's a fairly pointless operation though.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
I must have mis-understood the initial requirements.

I had thought that a regular (non-frame) page was shown, and when the button on that page was clicked, the page was replaced with a frameset - but keeping the URL the same.

Alex,

Can you clarify if that is the case, or whether having a frameset loaded initially would be acceptable?

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top