window.open()
in a callback when using dojo.xhrPost
and dojo.xhrGet
. This is a false positive with the popup blocker. The pop up blocker is usually a good thing, so we don't want to just tell the user to disable it. We need another way to get around this.Spent a good amount of time finding the answer to this, so figured I'd re-post it in case someone else has the same troubles.
For reference, I needed to do this as the page I wanted to open wouldn't be available until after a server hit was processed. Here's what I had.
dojo.xhrGet({
url: some/url.html,
load: function(){
window.open('some/other/url.html');
}
});
Without boring you with the details, the solution was to move the
window.open()
call out of the callback and then hold the window reference in a variation so that the window location could be updated after the server hit.var winRef = window.open();
dojo.xhrGet({
url: some/url.html,
load: function(){
winRef.location = 'some/other/url.html';
}
});
Big thanks to Jens Arps for the solution to this issue.
Thanks for the info but how you will make it work if you have headers param to send ?
ReplyDelete