Solved

Make a browser close after n seconds

Posted on 1998-04-18
4
152 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

792 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