Skip to content

Instantly share code, notes, and snippets.

@anilmeena
Created October 22, 2016 02:52
Show Gist options
  • Save anilmeena/394dafe124bd2a66858ab4d5a428f815 to your computer and use it in GitHub Desktop.
Save anilmeena/394dafe124bd2a66858ab4d5a428f815 to your computer and use it in GitHub Desktop.
Avoid browser popup blockers
/* Pseudo code with Javascript snippets: */
// Immediately create a blank popup on user action
var importantStuff = window.open('', '_blank');
// Optional: add some "waiting" info message. Examples:
// a) An external HTML page: replace the above line with
var importantStuff = window.open('http://example.com/waiting.html', '_blank');
// b) Text: add the following line below the above one:
importantStuff.document.write('Loading preview...');
// Fill it with content when ready (when the AJAX call is returned, for instance)
importantStuff.location.href = 'http://www.divyanshiinfotech.com/';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment