duanlu9557 2017-04-12 03:11
浏览 93

如何在打开新标签时保留标签(打开文件)?

I have a link to open a pdf in a browser. But, It gets focused on the new tab (the tab with the pdf. How to prevent this behavior?

This is the link:

<strong><a style="text-decoration:none" class='row_link' href='javascript:void(0)' target="_blank" onFocus="false">Open File</a></strong>

This is the jquery:

$("#myTable tbody").on('click','.row_link', function(e) {
    var no_s    = $(this).find('.filename').val().replace(/\//g , '');
    var b_url   = $('#base_url').val()+"assets/uploads/file/";

    var url     = b_url + no_s;
    window.open(url);
});

I've tried adding onfocus="false" in the anchor. But, It's no effect

  • 写回答

4条回答 默认 最新

  • dongmi4734 2017-04-12 03:19
    关注

    <html>
    <strong><a style="text-decoration:none" class='row_link' href='https://github.com/caiyongji' onclick="window.open('#','_blank');window.open(this.href,'_self');">Open File</a></strong>
    </html>

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?