JavaScript:location.href在新窗口/标签中打开?(JavaScript: location.href to open in new window/tab?)

编程入门 行业动态 更新时间:2024-10-23 02:04:49
JavaScript:location.href在新窗口/标签中打开?(JavaScript: location.href to open in new window/tab?)

我有一个来自第三方开发人员的JavaScript文件。 它具有将目标页面替换为目标的链接。 我想在这个新标签中打开这个页面。

这是我到目前为止

if (command == 'lightbox') { location.href="https://support.wwf.org.uk/earth_hour/index.php?type=individual"; }

谁能帮我吗?

I have a JavaScript file from a third party developer. It has a has link which replaces the current page with the target. I want to have this page opened in a new tab.

This is what I have so far:

if (command == 'lightbox') { location.href="https://support.wwf.org.uk/earth_hour/index.php?type=individual"; }

Can anyone help me out?

最满意答案

window.open( 'https://support.wwf.org.uk/earth_hour/index.php?type=individual', '_blank' // <- This is what makes it open in a new window. ); window.open( 'https://support.wwf.org.uk/earth_hour/index.php?type=individual', '_blank' // <- This is what makes it open in a new window. );

更多推荐

页面,JavaScript,command,电脑培训,计算机培训,IT培训"/> <meta name="descrip

本文发布于:2023-08-07 04:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1461230.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:新窗口   标签   href   JavaScript   location

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!