Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window Close / focus question : newbie

Status
Not open for further replies.

rlingen

Technical User
Dec 6, 2000
41
CA
I am a javascript newbie. I've got some basic window opening / focus issues working, but I can't get a handle on this one. It has to do with opening a window and loading a page over which I have no control.

I have a page with a list. Each item in the list has a link to open another window that loads a page on somebody else's site (picture a list of headlines linking to the actual news articles at various sites -- not mine). When the user finishes with the second window, he will click on the original (list) page, using the window buttons at the bottom of his screen.

The problem is that when he clicks on another list item, which is again loaded into the second page, that page does not take the focus and come to the front. The new URL loads in the background, and the user sits and wonders where the page he asked for is.

I need to either: 1) close the second page when it loses focus or 2) get it to take focus onload WITHOUT being able to put anything in the code of that page (it's not my page).

I don't like solution #1, because it could be annoying. One slip of a mouse click and any navigation the user did on the second site is gone.

Any help greatly appreciated.

Roy
 
Try this,

In your window.open() function u should name the popup your opening so u can refer to it window.open("popup.html","MyPopup",....)

Now you can call it from the (list) page by putting an Onclick event in your links and setting the focus --

OnClick="MyPopup.focus()"

see if that works.



Rocco is the BOY!!

SHUT YOUR LIPS...
ROCCOsm.gif
 
Thanks, that did the trick. I created a function that included both new_window.open() and new_window.focus() statements. Worked perfectly.

Roy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top