0

On an commerce site, the user needs to be able to print an order.

I can do this with a popup window:

w = window.open();
w.document.write(data);
w.print();
w.close();

However, what should I do if the user has a popup blocker in place?

Is there another way of printing I should provide (ie, not using a popup) or should I assume that the user will enable the popup if he really wants to print? Google Maps seems to be using a popup window for printing so this seems to be an acceptable way of addressing this.

So the question is, how do I avoid the popup blocker issue?

Greg

Greg Gum
  • 33,478
  • 39
  • 162
  • 233

1 Answers1

1

Maybe opening the window in a new tab helps. However, I think it is not possible to control window blocking in JavaScript.

Please see this example:

var OpenInNewTab = function (url )
{
  var win=window.open(url, '_blank');
  win.focus();
}

source: https://stackoverflow.com/a/11384018/1054926

Fiddle: http://jsfiddle.net/Jr8dk/2/. Tested in Safari 7 without Pop-ups disabled.

Community
  • 1
  • 1
Kukiwon
  • 1,222
  • 12
  • 20