asked on
ASKER
ASKER
ASKER
<?php
$forcedSave = true;
if ($forcedSave) {
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
header('Content-Type: application/force-download');
else
header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="tmp.pdf"');
}
else {
header('Content-Type: application/pdf');
header('Content-disposition: inline; filename="tmp.pdf"');
}
?>
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.
TRUSTED BY
I use the following function to force a save, or give the option to the user to view or save a pdf file. (This can open up the client's Save As Dialog)
Open in new window