Solved

Make a browser close after n seconds

Posted on 1998-04-18
4
143 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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-…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

912 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now