There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
bios black screen blue screen blue screen of death boot computer connection crash css dell display driver drivers email error firefox firefox 3 game hard drive internet internet explorer itunes laptop malware monitor network networking nvidia outlook outlook 2003 outlook express partition password printer problem problems router security slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
simple close window


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Toddmaster184's Avatar
Junior Member with 6 posts.
 
Join Date: Apr 2007
Experience: Intermediate
17-Jan-2008, 10:33 AM #1
simple close window
This is probably the dumbest question on here but hey I gotta ask. This simple javascript code that closes the window...

javascript=window.close();

how can I make it so that it does not alert the user. Basically I want to get rid of the javascript alert that says "Are you sure....[OK] [Cancel]" I've searched around online and found a few suggestions but they didnt work.

ie. javascript=window.parent.cloe();

javascript=window.self.close();

any other suggestions or way to do this. The close itself is used with a button.

Thanks
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,716 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
17-Jan-2008, 01:59 PM #2
Here is sample HTML that does what you want:

Main page:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title>Javascript close window</title>
</head>
<body>
Click <a target="_blank" href="close-win.html">this
link</a> to open a window
</body>
</html>
close-win.html:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title>Close window</title>
</head>
<body>
Click <a onclick="window.close();" href="#">this
link</a> to close this window
</body>
</html>
Does that help?

Peace...
TheRobatron's Avatar
Computer Specs
Senior Member with 482 posts.
 
Join Date: Oct 2007
Location: England
Experience: Intermediate
17-Jan-2008, 04:08 PM #3
The message asking the user if they want to close the window is usually built into the browser, so I don't think there's any way of disabling it.
Fyzbo's Avatar
Senior Member with 1,777 posts.
 
Join Date: Feb 2002
Location: North Carolina, USA
Experience: Programming-Advanced|EVER
17-Jan-2008, 04:20 PM #4
The confirmation is a browser feature to protect the user. For example, my browser is set up to open all pop-ups and new windows in a new tab. If the popup tries to close itself it would close my entire browser, including all the other tabs, so I'm glad it asks as I always cancel.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:34 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.