Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

HTML Window Closing


  • Please log in to reply

#1
bennydog

bennydog

    Member

  • Member
  • PipPip
  • 77 posts
Whats There a Html or Java script Code To Close The Current Window.
And Works In Firefox.
:tazz:

Edited by bennydog, 12 August 2005 - 06:14 AM.

  • 0

Advertisements


#2
sprout

sprout

    Member

  • Member
  • PipPip
  • 33 posts
If you mean having a button or text that can be clicked on to close a window, its:
<FORM>
<INPUT TYPE='BUTTON' VALUE='Close Window' onClick='window.close()'>
</FORM>

This will create a button for the purpose, however you could just use a text link like this:
<a href="java script:window.close()">Close</a>

If you are wanting to automatically close a window, this is a little more complex...look here:
http://www.htmlgoodi...cle.php/3470941
  • 0

#3
bennydog

bennydog

    Member

  • Topic Starter
  • Member
  • PipPip
  • 77 posts
Both of these only work in my explorer browser,
i need one that works in netscape as well (fire fox)
  • 0

#4
ssone

ssone

    Member

  • Member
  • PipPipPip
  • 301 posts
It worked for me in firefox. Put this code in a test page and try it again:

<html>
<title>SSOne (JavaScript: Close Window)</title>
<body bgcolor="#FFFFFF">


<a href="javascript:window.close();">Close This Window</a>

<br>

<form>
<input type=button value="Close This Window" onClick="javascript:window.close();">
</form>


</body>
</html>

  • 0

#5
sprout

sprout

    Member

  • Member
  • PipPip
  • 33 posts
Works fine in my Firefox as well...this code is browser independent, shouldnt matter.
  • 0

#6
jpgmf

jpgmf

    New Member

  • Member
  • Pip
  • 1 posts
Hello!
If you are trying to close a popup, window.close() doesn't work.
See your javascript console for more information. I'm having the same problem

Bye

Joćo Faria
  • 0

#7
Poetic.Garbage

Poetic.Garbage

    Member

  • Member
  • PipPip
  • 55 posts
Could you put the following code somewhere?
onLoad='javascript:window.close();' 

  • 0

#8
revac71

revac71

    New Member

  • Member
  • Pip
  • 1 posts
Hello!,

The command window.close() works on IE6 but it doesn't on FireFox.

Here the script called in the popup window:

<script language="javascript">
<!--
function closeSeqQuesWindowOK() {
... some non relevant lines ...
window.close();
}
document.onload = closeSeqQuesWindowOK();
// -->
</script>

I guess FF has some security restrictions, am I right?
Any ideas? Is there any way to make it work?

Thanks!
  • 0

#9
vodkarev

vodkarev

    New Member

  • Member
  • Pip
  • 2 posts
I also am trying to do this in Firefox and can not get any scripts to work.... we are using firefox 1.0.6

Anyone know how to do this in Firefox?
  • 0

#10
Haemoglobin

Haemoglobin

    New Member

  • Member
  • Pip
  • 7 posts
I also have been trying to run that script on firefox for a ages now but it just doesn't work. So also are other scripts...........Firefox is very funny when it comes to Javascripts.
:tazz:

I also am trying to do this in Firefox and can not get any scripts to work.... we are using firefox 1.0.6

Anyone know how to do this in Firefox?

View Post


  • 0

#11
geekygirl

geekygirl

    Member

  • Member
  • PipPip
  • 32 posts
Works fine for me. Running Firefox v1.0.6 as well.
Only thing I can think of is are you running Norton 2005 AntiVirus? I have clients who cannot view some items using Javascript with Norton 2005. But then, that is the only common thing I have found why they can't view it.
Perhaps it is just my site. :tazz:
  • 0

#12
vodkarev

vodkarev

    New Member

  • Member
  • Pip
  • 2 posts
Well I've used various scripts on diff servers and it never has worked for me.... it also doesn't work on other people sights... take for instance www.nasn.co.uk go through the shop, buy something a window pops up with a close button and it doesn't work...
  • 0

#13
tuomo

tuomo

    New Member

  • Member
  • Pip
  • 1 posts
You can only close windows with Firefox if you have done the window with javascript. javascript:window.close() or javascript:self.close(). It is a feature in Firefox - maybe security feature
  • 0

#14
Tyger

Tyger

    Member 2k

  • Member
  • PipPipPipPipPip
  • 2,896 posts
You can also put simple script on which will automatically close the window or frame after a certain time.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP