Solved

Set focus to a recently opened window

Posted on 1998-10-05
4
210 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Read about why website design really matters in today's demanding market.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

706 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

17 Experts available now in Live!

Get 1:1 Help Now