简体   繁体   English

window.location 在新标签页中打开链接

[英]window.location opening links in a new tab

So far I have到目前为止我有

<div style="position: absolute; left: 47%; top: 70%; margin-right: -52%; transform: translate(-50%, -50%)" onclick="window.location='https://steamcommunity.com/';">

I want to open this page in a new tab, but have issues using window.open since the class is an image.我想在新选项卡中打开此页面,但在使用 window.open 时遇到问题,因为该类是图像。 Any Suggestions?有什么建议?

您可以改用 target="_blank":

<a href="https://steamcommunity.com/'"  target="_blank"/>

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

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