0
votes

chrome browser

버전 : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36

onclick link

<!DOCTYPE html>
<html>
<body>
<script>
function winopen(url){
    window.open(url, '_blank');
    }
</script>
<p>Open link in a new window or tab: <a href="javascript:winopen('https://www.w3schools.com');" target="_blank">Visit W3Schools!</a></p>

</body>
</html>

O : https://www.w3schools.com window open
X : about:blank window open

1
Don't use the javascript scheme. Use onclick="winopen(url)" or addEventListener to attach the event in JavaScript. You should also consider not using popups and the like. Let the users open URLs in the window they would like to open URLs in. It's much more user friendly.Heretic Monkey
Read stackoverflow.com/questions/2479557/… for why you don't want to do this in the first placeJaromanda X
Thanks for explaining the difference then suggesting a better way.Cha

1 Answers

0
votes

I guess you are trying to open a link in a blank window? if you try changing your href so it points directly to the link.

HTML

    <!DOCTYPE html>
<html>

<body>
    <script>
        function winopen(url) {
            window.open(url, '_blank');
        }
    </script>
    <p>Open link in a new window or tab: <a href="https://www.w3schools.com" target="_blank">Visit W3Schools!</a></p>

</body>

</html>