douhui1957 2017-10-23 17:51
浏览 34

通过任何方法重定向到新选项卡。 (JS,Symfony PHP组件等)

What I would like to do is to open a new link after setting a timer of 5 seconds on my "thank you" page. What I currently have right now is that the link that should be opened redirects on the same page. Is it possible to do this? What I was planning is to redirect the "thank you" page I have on my homepage while the new tab to be opened will be redirected to an external link. Thanks in advance. I've read solutions like the window.open but I think it isn't the one I'm looking for and most of the searches I encounter says that it doesn't allow it since it is treated as a "popup". Here is what I have now.

$(function () {
        setTimeout(function () {
            window.location = $('#redirect-url').attr('data-redirect-url');
        }, 5000)
    })
  • 写回答

1条回答 默认 最新

  • doujuncuo9339 2017-10-23 17:55
    关注

    try this:

    $(function () {
        setTimeout(function () {
            window.location = $('#redirect-url').attr('href','data-redirect-url');
        }, 5000)
    })
    

    The .attr requires two parameters (attribute, value to that attribute)

    EDIT
    to open a new window, i know just this:

    window.open('pageIWant.html', '_blank');
    

    But it can really be treated as a popup by some browsers

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?