473,382 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Popup Window Detection and Close Button Activation

Greetings,

I do not know whether such code exist but no harm asking:

Is it possible for me to make visible a close button if the active
window is a popup window or a new window (other than the main window)?

What I mean is this:

If the present window is the main window, then the close button should
not be visible on the page. Otherwise, the close button should be made
visible and active (i.e. can be clicked to close the window).

Any help is much appreciated.
Jul 23 '05 #1
6 2653
rf
andrewkooi wrote
Is it possible for me to make visible a close button if the active
window is a popup window or a new window (other than the main window)?


All windows have a "close" button anyway. That X that the top right.

--
Cheers
Richard.
Jul 23 '05 #2
On 31 Aug 2004 01:47:06 -0700, andrewkooi wrote:
Is it possible for me to make visible a close button if the active
window is a popup window or a new window (other than the main window)?


Check opener property of the current window.

for example:

<script type="text/javascript">
window.onload=function(){
if (window.opener)
document.getElementById("btnClose").style.visibili ty="visible";
}
</script>

--
ZER0://coder.gfxer.web-designer/

~ Io non soffro di pazzia, ne godo ogni minuto.
(I don't suffer from insanity, I enjoy every minute of it)

on air ~ "Ligabue - Ho Messo Via"
Jul 23 '05 #3
rf wrote:
andrewkooi wrote

Is it possible for me to make visible a close button if the active
window is a popup window or a new window (other than the main window)?

All windows have a "close" button anyway. That X that the top right.

Or a red circle top left....
Mac OSX
Mick
Jul 23 '05 #4
Greetings,
<script type="text/javascript">
window.onload=function(){
if (window.opener)
document.getElementById("btnClose").style.visibili ty="visible";
}
</script>


This code appeared to work fine in IE6 but does not work in NS7, or
even the latest versions of Opera and Mozilla. Any ideas how to
resolve this?

Thanx.
Jul 23 '05 #5
On 1 Sep 2004 05:48:38 -0700, andrewkooi wrote:
This code appeared to work fine in IE6 but does not work in NS7, or
even the latest versions of Opera and Mozilla.


This code works also in gecko-based browser (my default browser is not IE
but Firefox).
Try this page, for example:

<html>
<head>
<title>Untitled</title>
<style type="text/css">
#btnClose{margin-top:8px;display:block;visibility:hidden;}
</style>
<script type="text/javascript">
window.onload=function(){
if (window.opener)
document.getElementById("btnClose").style.visibili ty="visible";
}
</script>
</head>

<body>

<button onclick="window.open(window.location.href)">open a popup</button>

<button id="btnClose" onclick="window.close()">you are in a
<strong>popup</strong> window.<br />Click this button to close.</button>

</body>
</html>

(tested on FF)

--
ZER0://coder.gfxer.web-designer/

~ "Rispetto e' Memoria, non Oblio."

Jul 23 '05 #6
andrewkooi wrote:
Is it possible for me to make visible a close button if the active
window is a popup window or a new window (other than the main window)?


You asked that a few hours before, and my answer is still the same.
It is inappropriate to re-post within such a short amount of time
only because no one replied to date. Especially on Google Groups
postings take time to be archived, since it is only an archive of
Usenet postings.
PointedEars
--
All I asked for was a simple rotating chair! Throw me a frickin' bone here!
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
4
by: moose | last post by:
OK Popup window? No problem PDF in popup? No problem But what about a couple of Close Window buttons? Imagine a "Close Window" button at the top of the popup page. Then the PDF which can...
26
by: Raffi | last post by:
Hi, We have a database application that runs in a popup Internet Explorer application window. The reason for this is to isolate the casual user from the address bar and the typical IE navigation...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. ...
2
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully...
5
by: wreed06 | last post by:
I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML...
1
by: dittu | last post by:
How to close the popup window when submitting the form? I have a sample.jsp. In that page one button is there. when button pressed, open popup window contains one "text box" and one " submit...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.