触发<a href="url" rel="noreferrer"> in the success of an ajax request

时间:2017-10-23 00:29:28

标签: javascript jquery html ajax

In my ember application, I have a dialog box with 'OK' and 'Cancel' buttons. On clicking on 'OK', an action will be triggered in which an ajax request will be sent and in its success, a new tab with a certain url has to be opened. I tried triggering a click in the success of the ajax request, but the pop up gets blocked. Here I want to use an

    <a href=url rel='noreferrer'> 

rel='noreferrer' because I want the new tab to occupy seperate browser memory and not that of the current window. Hence I cannot create an element with window.open() before the ajax request and then change the location(url) in the success of it. ( new tab opened using window.open() will occupy the memory of the window from which the new tab got triggered). It would really help if I could get a solution. Thanks in advance :)

1 个答案:

答案 0 :(得分:0)

当您正在寻找触发点击操作的方法时,听起来更广泛地说您正在尝试从noreferrer函数内部创建javascript弹出窗口。我认为这可能采用两部分方法:

  1. 使用仅包含小脚本标记的window.open()打开一个新弹出窗口。这不会触发弹出窗口阻止程序,尽管它仍然会共享链接页面的内存。

  2. 使用脚本标记(在弹出窗口内)触发HTML元重定向(其中包含here所述的no-referer选项。

  3. 请注意,您无法在一个步骤中执行此操作,因为您无法将HTML元重定向到新窗口,只能执行当前窗口(source)。