Center Popup Window

Center Popup Window

by David Coleman -
Number of replies: 7
Is there anyway to center a new popup window?

Thank you.
Average of ratings: -
In reply to David Coleman

Re: Center Popup Window

by Mat Cannings -
As far as I can remember the only way to centre a popup window is through the use of a Javascript routine that is embedded in the page contained within the pop up.

An example of code to achieve this is here http://javascript.internet.com/navigation/centered-popup.html

The code pops up a new window, then once the page has loaded it calls a routine that compares it's dimensions to the screen resolution and then repositions itself accordingly. Because of this it only works on pages that have the reposition code in them, so a pop up with google in would not work (and you would have to add the repositioning Javascript to all your own pages).


In reply to Mat Cannings

Re: Center Popup Window

by David Coleman -
I'll give it a try.

However, I'm not sure where to find the original javascript code that I need to update.

For example, here's what the popup code looks now:

Popup Window

Can you please point me to the file where I need to add this new Javascript to.

Thanks for helping smile
In reply to David Coleman

Re: Center Popup Window

by David Dyer -
You'd have to add the code to the page being called, i.e. put it in between script tags on the page you want the user to access, or link to a .js file from that page. So this won't work for pop-up links to pages that you haven't created yourself.
In reply to David Coleman

Re: Center Popup Window

by Chris Lamb -

Yes, you can centre any popup window with any site in it.  Download the attached HTML file, open it in Internet Explorer, and click the link - you should get the BBC website in the centre of your screen.

Using the javascript in the file you can define the size of the window, (edit 'pageheight' and 'pagewidth' in the script), and you can also choose whether to show the address bar, toolbar, scrollbars, and menu bar, and whether to allow the window to be resized.

You can use the script multiple times on the same page - just put different URLs in the 'href' link (you'll see where I'm calling the BBC site).

HTH

Chris

In reply to Chris Lamb

Re: Center Popup Window

by David Coleman -
Thanks for the attached HTML file.

I was hoping that the "Link to a file or web site" resource had an option 'Center Window' under the 'New Window' section. For example, the "Link to a file or web site" resource allow me to open the Location in a new window and resize it to any thing I want. I just wish there was an option too that allowed this new window to be centered. Do you know of the resource file I could edit to add this functionality.

Thanks.
In reply to David Coleman

Re: Flash javascript code for oprn center popup window

by ketan 4666 -

How to open HTML popup by using flash javascript code ? When we click on the button of flash , the html popup should be open in the center of the screen

ketan4666@yahoo.co.in

In reply to ketan 4666

Re: Flash javascript code for oprn center popup window

by Marion de Groot -
You could use an external interface call to call the javascript function from the swf