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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pop up window query

Status
Not open for further replies.

zenmango

Technical User
Joined
Apr 26, 2006
Messages
4
Location
AU
Gday!
I am trying to find if there is a way to stop more than one instance of a popup browser window from occurring...

is there code that can be added to a link to check if a browser/file is already open and simply bring this page/file to the front again???

there are two ways I commonly create a new browser and would like them to function as desired above:


1...(the most common one of course)

<a href="intro.html" target="_blank">ENTER</a>

eg:

2...(a dreamweaver hotspot map)

<map name="Map">
<area shape="rect" coords="4,4,174,116" href="#" onClick="MM_openBrWindow('../enlargements/004.jpg','','width=373,height=370')">
</map>

eg: (click on any image or slideshow at bottom of page)

-------
In both cases you can end up with unlimited open browsers of the one page/file if you keep clicking on the link and I would love to restrict this for heaps of other applications like media players, etc...

would really appreciate some help here

cheers, z
 
For your second parameter to the MM_openBrWindow function, use a name rather than empty string... so replace '' with 'aWindow' or any other name you like.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Note: The name must NOT have a space in it, or be a reserved word... so things like "A Window" or will not work in all browsers. Your best bet is to give it a meaningful reference, i.e. "statsWindow" or "lookupWindow", etc.

Dan


Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Ok...I am a little vague on this...script is not my main area but coming a bit clearer...after all this time..

so how do I correctly add the second parameter??

after "MM_openBrWindow(...\file.html)""MM_lookupWindow...

or is it more like:

"MM_openBrWindow_lookupWindow...

cheers, z
 
Change this:

Code:
MM_openBrWindow('../enlargements/004.jpg',[!]''[/!],'width=373,height=370')

to this:

Code:
MM_openBrWindow('../enlargements/004.jpg',[!]'aWindow'[/!],'width=373,height=370')

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Excellent!! Thanks heaps for your help...

Have just updated the main html link...


this has resolved the most important issue of extra browsers but is there a way that when the new window open and is hidden behind other open browsers to bring this page to the front when clicking the link again...

it also has a bug with sometimes opening in an already open browser...any ideas???

cheers, z
 
You would need to modify either:

- your window opening routine to call the window's "focus" method after opening it, or

- your target pages to focus themselves onload.

If you don't have full control of the target pages, opt for the first... if you have, then either would work, but the first is far less work (so it looks like the first is the way to go).

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
ok...where does the "focus" command go for this instance>>>

<a href="intro.html" target="aWindow">ENTER</a>

or does this command go into the target window head??

cheers, z
 
You can't focus a window opened with HTML alone... you'd have to use JavaScript to re-open the window, and grab a handle to it... so maybe in this instance, the second method would be better.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top