Solved

Make a browser close after n seconds

Posted on 1998-04-18
4
155 Views
Last Modified: 2006-11-17
Make a browser close after n seconds can someone give me the script for it and
how to make a new window open when a user double click but when a user clicks
once it doesent do anything please the code for both of them.
0
Comment
Question by:Marc1
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
Christian_Wenz earned 1000 total points
ID: 1265086
you cannot always close the whole browser, but you can close a browser window in n seconds:
<SCRIPT LANGUAGE="JavaScript"><!--
  setTimeout("self.close()", n)
//--> </SCRIPT>

A doubleclick is only recognized with netscape Communicator 4; however here's a trick that does something when you click twice on a button:

<INPUT TYPE="BUTTON" VALUE="doubleclick me" onClick="test()">

and the function test looks like this:

var count = 0
function test(){
  count++
  if (count==2){
   var MyWin = new window()
   MyWin.open("newwindow.html")
  } else setTimeout("count--", 500)
}

so the user has 500 milliseconds to click twice on the button, otherwise the counter is set back.

If you have questions about this, please leave me a comment here, I'll try to answer asap. :-)
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1265087
Wow!
0
 

Author Comment

by:Marc1
ID: 1265088
Thanks alot
with the double click is there a way to instead of a button i couls put a link?
0
 
LVL 5

Expert Comment

by:Christian_Wenz
ID: 1265089
if you let the link point to the JavaScript function (HREF="JavaScript:functionname()"), it should be possible...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question