473,434 Members | 1,834 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,434 software developers and data experts.

Can I focus a popup window without refreshing it?

The crux of the problem is I only know if the popup *has been* opened,
but not if it *is* open. Therefore, the script doesn't know whether to
simply refocus, or whether to popup a fresh window.

Are these the only solutions?
* handle onerror in some creative way
* hidden frames

BTW, I do have the luxury of ignoring non IE 5.5+ browsers on this
project, if it helps.

Thanks,
Jamie
Jul 20 '05 #1
4 8912
Jamie Jackson wrote:
The crux of the problem is I only know if the popup *has been* opened,
but not if it *is* open. Therefore, the script doesn't know whether to
simply refocus, or whether to popup a fresh window.

Are these the only solutions?
* handle onerror in some creative way
* hidden frames

BTW, I do have the luxury of ignoring non IE 5.5+ browsers on this
project, if it helps.

Thanks,
Jamie


Just attempt to window.open() with the same window name (2nd parameter).
If the window is open, the new URL will load in it, if it's not open, it
will open a new window with that name.

These will open in the same window:
<a href="#" onclick="window.open('http://www.yahoo.com',
'theWindow');return false;">Yahoo</a>
<a href="#" onclick="window.open('http://www.microsoft.com',
'theWindow');return false;">MS</a>
<a href="http://www.ebay.com" target="theWindow">eBay</a>

These will open in a different window:
<a href="http://www.cnn.com" target="_blank">CNN</a>
<a href="#" onclick="window.open('http://www.msnbc.com',
'someOtherWindow');return false;">msnbc</a>

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2
On Wed, 24 Sep 2003 19:57:04 GMT, Grant Wagner
<gw*****@agricoreunited.com> wrote:
Jamie Jackson wrote:
The crux of the problem is I only know if the popup *has been* opened,
but not if it *is* open. Therefore, the script doesn't know whether to
simply refocus, or whether to popup a fresh window.

Are these the only solutions?
* handle onerror in some creative way
* hidden frames

BTW, I do have the luxury of ignoring non IE 5.5+ browsers on this
project, if it helps.

Thanks,
Jamie


Just attempt to window.open() with the same window name (2nd parameter).
If the window is open, the new URL will load in it, if it's not open, it
will open a new window with that name.

These will open in the same window:
<a href="#" onclick="window.open('http://www.yahoo.com',
'theWindow');return false;">Yahoo</a>
<a href="#" onclick="window.open('http://www.microsoft.com',
'theWindow');return false;">MS</a>
<a href="http://www.ebay.com" target="theWindow">eBay</a>

These will open in a different window:
<a href="http://www.cnn.com" target="_blank">CNN</a>
<a href="#" onclick="window.open('http://www.msnbc.com',
'someOtherWindow');return false;">msnbc</a>


Thanks for the reply. Unfortunately (unless I missed something), I
don't think the question (of how to keep the popup from refreshing)
has been addressed.

Here's why I'd prefer that it didn't refresh: I've got a good bit of
content (help files) in the popup, and I don't want to lose the scroll
position, since the user might be in the middle of reading something,
they click on the parent, and they want to go back to the popup (by
re-clicking the help link from the parent). It would be nice if I just
refocused that window the next time the "help" link was clicked,
instead of reloading the URL into that window, and starting from
scratch.

Any ideas?

Thanks,
Jamie

Jul 20 '05 #3
Jamie Jackson wrote:
how to keep the popup from refreshing
window.closed may provide the answer:
var hwin=null;

function showHelp(href)
{
if(hwin && !hwin.closed)
hwin.focus();
else
hwin=window.open(href,"help_win");
}

.....

<a href="help.html"
onclick="showHelp(this.href);return false;" help </a>

The closed property was introduced in javascript 1.1, and although not
standardised is widely implemented. For further information on
downloading Netscape documentation for Javascript 1.3, please consult
the NG FAQ

Dom
========
http://www.jibbering.com/faq/#FAQ3_2
Jul 20 '05 #4
Hmm, I'll play with that. Thanks!

Jamie

On Fri, 26 Sep 2003 10:42:47 +0930, Dom Leonard
<do*************@senet.andthis.com.au> wrote:
Jamie Jackson wrote:
how to keep the popup from refreshing


window.closed may provide the answer:
var hwin=null;

function showHelp(href)
{
if(hwin && !hwin.closed)
hwin.focus();
else
hwin=window.open(href,"help_win");
}

....

<a href="help.html"
onclick="showHelp(this.href);return false;"
> help </a>

The closed property was introduced in javascript 1.1, and although not
standardised is widely implemented. For further information on
downloading Netscape documentation for Javascript 1.3, please consult
the NG FAQ

Dom
========
http://www.jibbering.com/faq/#FAQ3_2


Jul 20 '05 #5

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

Similar topics

2
by: N/A | last post by:
Hey all, If I open a popup like this window.open('http://www.google.com', 'popup', 'width = 618, height = 425, directories = no, location = no, menubar = no, resizable = no, scrollbars = yes,...
2
by: Fred Snider | last post by:
Help! Opening a new window using the window.open( ) command works great for opening new windows and having them on top and having the focus. The window.focus command brings any existing...
9
by: Randell D. | last post by:
Folks, I'm working on a contact name/address database whereby a slimed down list is shown in the main window. When a record is selected, the complete record is displayed in a new window via a...
31
by: Benno Bös | last post by:
If I use the following construct in the frame "main" for a link to an extern site: <A HREF="http://www.any.xy" TARGET="extern"> the Browser is creating the window "extern", loading the page...
2
by: Moist | last post by:
Hi, first I must admit this is one of the most active group I have ever seen. For my question: is it possible to create a small popup window that remain in focus until it is closed. That is,...
3
by: Dave | last post by:
We are developing a web page that shows large graphics. To provide more screen space for the graphics, we allow the user to popup a window that places itself over the top part of the browser. This...
2
by: Elsa Luiz | last post by:
Hi everyone, I have this problem hope you could help me... I have an A.aspx page with a button, when I click the button I would like to open another window with containing B.aspx. The problem is...
1
by: Jennyfer J Barco | last post by:
Hello I have a datagrid and a linkbuttom in the datagrid that says Picture, every time I click on the link "Picture" my program opens a popup window showing a picture of the item the selected and...
11
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.