简体   繁体   中英

Html a element target _blank not working

I have the following javascript constant:

const url = 'www.google.com';

And I am trying to open it in a new window everytime someone selects the following link:

<a href={url} target="_blank">Google</a>

but instead I get:

localhost:8080/firstApp/index.html#https://www.google.com

尝试将“//”添加到您的网址中,如下所示:

const url = "//www.google.com";

您的网址应以httphttps开头

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