Solved

Set focus to a recently opened window

Posted on 1998-10-05
4
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

739 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