Solved

Set focus to a recently opened window

Posted on 1998-10-05
4
211 Views
Last Modified: 2013-12-25
How do I move the focus to a recently opened window in IE4? Say I have a parent window, and want to open a subwindow (not a modal dialog). It works fine the first time, but if the user moves back to the parent window, and then wants to open the subwindow again, it doesn't get focus, and the user doesn't notice that it has been loaded with new data.

I've tried to use the focus method without success, because every _second time_ I get an "Access denied" error message.

The code looks like this:

function openwin()
{
  var newwin = window.open("myurl.asp?param1=value1",
               "mywin");
  newwin.focus();
}

Any thoughts?
0
Comment
Question by:mnprsd
  • 3
4 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 100 total points
ID: 1855475
The newwin.focus() is correct.

The reason it does not work needs to be investigated - sounds like a bug!
In the mean time put a
<BODY onLoad="if (window.focus) self.focus()">
in the page returned from the asp


0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1855476
PS: What version does it say in HELP,ABOUT ?
IE4.0 is pretty buggy! 4.01 is a lot better

Michel
0
 

Author Comment

by:mnprsd
ID: 1855477
Thanks a lot, it works perfect.

And about the version; IE tells me I have version 4.0 (4.72.3110.8, SP1), but as far as I can remember, I recently installed version 4.01. But maybe 4.0 SP1 is the same thing.

However, thanks a lot again!
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1855478
Yep, that sounds like 4.01 (4.0 would be more like 4.70.2106.8) MS are so helpful in their version numbering and you can update the scripting engine separately.

Just to try and nail the bug, how exactly did you call your openwin function?
HREF, Button?

I hope to get enough info in order to add it to the BugList.

Thanks in advance

Michel
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Form Processing in PHP 11 41
Office 365 Pass Username an Password in URL 3 59
When should I use a controller? 3 34
CSS: Making Pure CSS read more boxes thinner 5 29
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

815 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

8 Experts available now in Live!

Get 1:1 Help Now