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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML to close current page

Status
Not open for further replies.

telephoto

Technical User
Nov 3, 2002
210
GB
I can't find any reference on how to have a click (on the word "close") close down the current web page.

I am using FrontPage, but I know how to get into the code.

Can this be done with HTML or do I have to brave the difficulties of Javascript?

TIA

Telephoto
 
Hi

HTML will certainly not do it. HTML does nothing. It is markup language.

You will have to use JavaScript for that, but just a little :
Code:
<a href="#" onclick="window.close();return false">close</a>
Not that in modern browsers [tt]window.close()[/tt] will only close windows opened with [tt]window.open()[/tt].

Feherke.
 
feherke said:
Note that in modern browsers window.close() will only close windows opened with window.open().

That's because people don't like when you close their browser. :)

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
thanks feherke

I found yourcode didn't work - but telling me I needed Javascript I checked another site....

Replacing the "close" in the HTML with this:
<a href="javascript:window.close()">Close</a>

It works a treat - thanks for the pointer

Telephoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top