Solved

Make a browser close after n seconds

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

708 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

16 Experts available now in Live!

Get 1:1 Help Now