简体   繁体   中英

Why isn’t this working href=“javascript”?

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM