Hi, I've come up with javascript that screen scrape html needed for report and save it on server using ajax call after which I call report that uses previously saved html through pop up. Here is code:
function SaveAndPrintHtml(htmlToPrint) {
try {
$.ajax({
type: 'POST',
async: true,
url: 'temp.aspx?Action=SaveHtmlToPrint', //SAVE DATA TO PRINT
data: {
htmlToPrint: encodeFormData(htmlToPrint)
},
dataType: "json",
success: function() {
try {
var url = 'report.aspx';
window.open(url, '_blank'); //OPEN REPORT
} catch (e) {
}
},
error: handleError
});
} catch (ex) {
alert('Unexpected Error!; \n\r ' + ex.message);
}
Idea is, when user click print button to pick up html from client send it to server save it and upon successful save open report that use previously saved html, in pop up window. This approach works fine on all browsers tested on both MAC & PC except for Safari on MAC.
Any idea why that might be?
EDIT:
JavaScript code that tries to open a pop-up window when the browser first loads (or unloads) a page will fail.
Taking in consideration above mentioned statement, it might be that Safari treats attempt to open pop-up window after ajax request as initial load/unload page stage and therefore forbids it?