What I want to do -
1) On Click of a button I will open a new window(popup).
2) When I click on same button, If the window(popup)is already open I will not open it again instead bring the previously opened window(popup) on top of all windows.
3) If popup is not open I will use window.open() to open a popup.
What I did till now -
1) On Click of a button I will open a new window(popup).
2) Problem : How do I not allow opening of new window on click of button if window is already open?
Here you go:
Javascript function:
<script language="javascript" type="text/javascript">
function popitup(url) {
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
}
</script>
HTML tag:
<a href="popupex.html" onclick="return popitup('popupex.html')">Link to popup</a>
Source: http://www.quirksmode.org/js/popup.html
Please take a look at the source for this and how they got it to work. They do also have some examples of exactly what you need.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments