Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

window.open is not working when I click to open the popup

When I click to open the new pop-up in Edge, it’s getting the error message Uncaught SyntaxError: Unexpected token ')'. That error only cause when I use window.open instead of window.location.
I didn’t use the window.location because it close up the first popup page and it replace the first popup page with the second one. But when I try to use window.open, it doesn’t response. I want to make is not to close the first popup when I click to open the second popup page. Is there anyway to do that? Also, when I add target=_blank in html, it just showing action:blocked and also tryna added target=popupand shows action:untitled.

$chrome_link = "http://example.com:8080/web/tools/information_hub1008x/lotbook/draw_def.php?lotid=".$getlotid."&tab=".$tab."&ocr=".$getocr."&postid=".$Now;
echo "<td rowspan=\"4\" colspan=\"4\"><a href=\"javascript:void()\" onclick=\"openURL('".$chrome_link."','".$tab."')\">Please Click me to Draw the Defect</a></td>";
    echo    "</tr>";

Below is JavaScript.

    function openURL(link,tab)
{

    if(tab != 'qualitychk' && tab != 'fabqadefchk'){
        var o = document.getElementsByName('waflist');

        for(z=0; z<o.length; z++)
        {
            if(o[z].checked == true)
            {
                var waf = o[z].value;
            }

        }

        link = link + '&curwaf=' + waf;
    }

  var ua = window.navigator.userAgent;
            if (ua.indexOf("Edg") > 0) {  //Edge
                window.open = link;
            }
            else if (ua.indexOf("Trident") > 0 || ua.indexOf("Chrome") > 0) {  //IE or Chrome
                window.open = ("microsoft-edge:link");
                
            }
}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

window.open is a function, not a property:

console.log(typeof window.open);

So you need to call it appropriately. Also note you need to actually concatenate the link into your call:

window.open(link);
window.open("microsoft-edge:" + link);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading