I've a pop up window which i'm opening using below script. On every click, i want to open new pop up. I understand, having unique name for the window will solve the problem (In this case "SampleWindow"). What's the best way to maintain the uniqueness of the window ? Is there any other way to manage javascript popup ?
window.open(url, 'SampleWindow', 'WIDTH=300,HEIGHT=250');
The syntax to open a popup is: window. open(url, name, params) : url. An URL to load into the new window.
To make the active window always on top, press Ctrl + Spacebar (or the keyboard shortcut you assigned).
A pop-up window is a window that appears on top of a help topic. The pop-up window sizes automatically to fit the amount of text or the size of the image in it. Pop-up windows remain on the screen until users click anywhere inside or outside of them.
Passing a value of _blank
to the name
parameter will load the passed URL
into a new window. Like this:
window.open(url, '_blank', 'width=300,height=250');
Other options for name
parameter (optional) include:
_blank
- URL is loaded into a new window. This is default
_parent
- URL is loaded into the parent frame
_self
- URL replaces the current page
_top
- URL replaces any framesets that may be loaded
name
- The name of the window
Do note that if you'll be passing this JavaScript to an anchor tag A
that IE browsers expect a return value, otherwise it'll referrence the A
tag itself. Your code for that would look like:
<a href="javascript:var w=window.open(url, '_blank', 'width=300,height=250');">test</a>
or better (to avoid showing users your code in the status bar):
<a href="javascript:void(0);" onclick="window.open(url, '_blank', 'width=300,height=250');">test</a>
Links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With