Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript <;a>;href concat自己的域加上另一个域_Javascript_Reactjs - Fatal编程技术网

Javascript <;a>;href concat自己的域加上另一个域

Javascript <;a>;href concat自己的域加上另一个域,javascript,reactjs,Javascript,Reactjs,当单击此按钮时,将加载: http://localhost:3000/www.anotherwebsite.net 我如何加载 一个URL如果不是以/开头,或者不是方案相关的,则将被视为相对路径 在域前面加上http或https: <a href={'https://' + post.domain} ... Prepend protocol,例如http://或仅//使用当前页面的协议。 <a href={'https://' + post.domain} target=&quo

当单击此按钮时,将加载: http://localhost:3000/www.anotherwebsite.net

我如何加载



一个URL如果不是以
/
开头,或者不是方案相关的,则将被视为相对路径

在域前面加上
http
https

<a href={'https://' + post.domain} ...

Prepend protocol,例如
http://
或仅
//
使用当前页面的协议。
<a href={'https://' + post.domain} target="_blank" rel="noreferrer noopener">
    Another Website
</a>
<a href={'https://' + post.domain} ...