2017-10-23 1 views
1

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'> in the success of an ajax request

<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 :)

답변

0

While you are looking for a method to trigger a click action, it sounds like more broadly you are trying to create a noreferrer popup from inside of a javascript function. I think this would be possible using a two-part approach:

  1. Open a new popup using window.open() containing only a small script tag. This will not trigger the popup blocker, though it would still be sharing the linking page's memory.

  2. Use the script tag (inside the popup) to trigger an HTML meta redirect (which incorporates the no-referer option as described here의 클릭 동작 트리거. 당신은 HTML의 메타를 할 수없는 것처럼, 하나의 단계에서이 작업을 수행 할 수

참고 새 창으로는 현재 창 (source)를 리디렉션합니다.

+0

newTab.document.write (""); 작동하지 않음 - 새 탭이 여전히 트리거 된 창 메모리를 차지함 @derekbrown – Srinithi

관련 문제