简体   繁体   English

目标 _blank url 在 React JS 生产构建中不起作用

[英]target _blank url not working in react js production build

When I clicked on the link, I got a 404 error in the production build of react js and showed an error on the firebase hosting website.当我点击链接时,我在 react js 的生产构建中遇到 404 错误,并在 firebase 托管网站上显示错误。

<Link target='_blank' to={'/property-details?id='some_id'}/>

To fix it, you can change your code to below.要修复它,您可以将代码更改为以下内容。

<Link to="/home" target="_blank" rel="noopener noreferrer" />

Just add the rel attribute to fix it.只需添加rel属性即可修复它。 This may also improve your page performance.这也可以提高您的页面性能。


If you want to use the <a> tag instead, then you can use the following code.如果您想改用<a>标签,则可以使用以下代码。

<a href="https://stackoverflow.com/" target="_blank" rel="noreferrer noopener">Stack Overflow</a>

The rel attribute will improve page performance. rel属性将提高页面性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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