Best way to "close the window" link

liunx

Guest
Can I do this with HTML? Or something that is not java, unless I have to. A link the user can "Close this report window." (I have popped up a new window with the new page and they can close it by clicking the link.)<!--content-->Hi,<br />
You can do it with javascript and it's quite easy to do. Just add the following to your page....<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:self.close()">Close this report window.</a><br />
<br />
If you are using Dreamweaver or similar just add the text of the link to the page (Close this report window.) and in the link field of your properties inspector type - javascript:self.close().<br />
<br />
That ought to do it.<br />
<br />
See ya<!--content-->Thanks but if there is a way without Javascript, that's what I want. Because of the people who turn it off.<br />
<br />
<br />
Originally posted by learninghtml <br />
Hi,<br />
You can do it with javascript and it's quite easy to do. Just add the following to your page....<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:self.close()">Close this report window.</a><br />
<br />
If you are using Dreamweaver or similar just add the text of the link to the page (Close this report window.) and in the link field of your properties inspector type - javascript:self.close().<br />
<br />
That ought to do it.<br />
<br />
See ya<!--content-->Hi,<br />
To be honest I wouldn't have thought that's likely to happen, simply because the vast majoirty of sites out there use javascript in everything from navbars to forms. It is after all a powerful tool and is reasonably safe as it can not read/write files etc..<br />
<br />
Personally I wouldn't worry about it, just put a note on the page somewhere explaining that javascript has to be enabled.<br />
<br />
Regards<br />
<br />
LearningHTML<!--content-->I read a repot that 87% have it enabled. For 13%, it's a no-go. I stay perplexed about using javascript. 13% is a lot.<!--content-->Hi,<br />
That's interesting to hear. I wonder why?<br />
<br />
I am constantly amazed by the surfing habits web users.<br />
<br />
Maybe they only use it for very specific purposes that do not require the use of java. Text only sites etc.. I can't think of any other reasons.<br />
<br />
Be interesting to know why those 13% don't use javascript?<br />
<br />
Anyway, back to your original question. I personally don't know of a way of closing a browser window using purely HTML. Someone out there might though...<br />
<br />
Regards...<!--content-->I don't know why they don't but it seems that over the past about five years, all kinds of gizmos and tricks came about because of the power of javascript and gurus started telling people to turn it off. That's what I have in my mind but it may not be right.<!--content-->As far as I am aware, you cannot close a browser window using pure HTML. Therefore, write your "window close" link using Javascript, like this:<br />
<br />
<script type="text/javascript"><br />
document.write('<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="self.close()">Close this report window.</a>');<br />
</script><br />
<br />
Some of the reasons people have JS disabled include:
  1. <br />
    Disability - meaning they are unable to use dynamic sites, etc.<br />
    Dislike of popup windows/other Javascript annoyances.<br />
    Using an old/incompatible browser.<br />
    Security concerns.<br />
    [/list=1]<br />
    I'm sure there are others and you may not agree with all those presented here (I don't), but you need to be aware of that 13% when designing sites.<br />
    <br />
    Adam<!--content-->
 
Back
Top