PDA

View Full Version : popup window question


Binky
08-02-2006, 03:26 PM
I'm using this link to open popup windows on a page:
javascript:newPopwin('something.html') on a page with this in the head</script><SCRIPT LANGUAGE="JavaScript">function newPopwin(page){Popwin=window.open(page,'','width=400,height=400, scrollbars=0,'+'resizable=yes,status=0,menubar=0,toolbar=0,'+'loc ation=0,directories=0,copyhistory=0');}</script>
The popup contains a link to another site. How can I get that link to either close the popup and open a new full-sized page, or open the linked page in the same window but resized to full size?

Adam
08-03-2006, 04:56 AM
Hi,

You may find this page (http://www.w3schools.com/htmldom/dom_obj_window.asp) useful, it lists all the options available on the Window object. You're probably looking for the resizeTo() and location properties, both of which are explained on that page.

You don't actually need JavaScript to make a pop-up, you can use regular HTML:

<a href="location.html" target="_blank">

The target="_blank" attribute tells the browser to use a new window. However, that function has been deprecated by the W3C because it is considered bad practice to force new windows, as a user can easily choose to open a link in a new window if they need to. So doing the same thing in JavaScript should also be avoided :smile:

Also, automatically redirecting and resizing windows is not generally a good idea. If a website uses pop-ups or resizes my window I will usually leave it. Not everybody browses at full screen, so forcing the browser to maximise can be very annoying, especially on large monitors.