繁体   English   中英

在新标签页中打开链接并延迟

[英]Open link in new tab with delay

我想在新标签中打开一个链接。 链接的HTML标记是

    <a id="target_link" target="_blank" href="http://yahoo.com">

但它根据我的期望不起作用。 我想在一段时间后在新标签中打开。 下面是jquery的片段,它工作得很好,但没有在新标签中打开

    setTimeout(function()
    {
        window.location = $('target_link').get('href');
    },1800);

你可以试试这个:

setTimeout(function () {
    window.open($('#target_link').attr('href'), '_blank');
}, 1800);
setTimeout(function(){
   window.open('https://support.wwf.org.uk', '_blank');
    },1800)

试试这个演示

暂无
暂无

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

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