Thursday 14 October 2021

Javascript - only allow HTML anchor redirect to open one window and use same window

 https://stackoverflow.com/questions/22857820/how-to-open-html-in-only-one-window-tab

https://www.quirksmode.org/js/popup.html

In general

var w= window.open(); It will not open new window again.



In detail :


<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>

No comments:

Post a Comment