/    Sign up×
Community /Pin to ProfileBookmark

Need to Close a Page Within a Frame

I’ve got a site with navigation in the left page of a frameset, with the main pages coming up on the right.

I need to put a “close this frame” button on the navigation page, to just leave the target page.

Anybody know how to do it? I’ve tried close.window and it doesn’t work.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJun 13.2004 — Hi!

Do you want the navigation frame to get blank or do you want to have the "target" page take the entire available space?

Cheers - Pit
Copy linkTweet thisAlerts:
@shirtblokeauthorJun 13.2004 — Hi Pit-

Hello from Aachen's twin town of Halifax.

I need the "target" page take the entire available space.

Any idea how to do it?
Copy linkTweet thisAlerts:
@PittimannJun 14.2004 — Hi!

Example:

<a href="targetPage.htm" target="_top">click</a>

If it needs to be a button or something else but an anchor tag, you can use:

onclick="top.frames.location.href='targetPage.htm'" inside that tag.

Greetings to Halifax :p

Cheers - Pit
Copy linkTweet thisAlerts:
@shirtblokeauthorJun 14.2004 — No that won't work.

The trouble is that the Target page could be anything on the web - I've no idea in advance what the URL of the target is.

I need something that will close the navigation part of the frameset without knowing anything about what is in the target frame.

Is that possible do you think?
Copy linkTweet thisAlerts:
@PittimannJun 14.2004 — Hi!

If you don't know the address how can the user know or the link to be clicked by the user? :p

<a href="#" onclick="top.frames.location.href=top.frames.targetFrameNameGoesHere.location.href">go to unknown page</a>

Cheers - Pit
Copy linkTweet thisAlerts:
@shirtblokeauthorJun 14.2004 — Ah - Getting there.

That code closes down the frame, but it comes up with an "Undefined" error when running it from my hard disk, - This is the URL....

C:My DocumentsWebDesign Stuffshirtblokenewsundefined

and when running from my server it goes straight into my custom 404 page.

See what I mean here....

http://www.easytoremember.pwp.blueyonder.co.uk/ShirtBloke//news/tester-index.htm

This removes the frame, but then replaces it when the 404 page comes up (which it is supposed to do).
×

Success!

Help @shirtbloke spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.9,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...