1

I'm creating a print (preview)window, for which I want to load the core html from the site assets:

The code:

window.open('/SiteAssets/reportingPrintBase.html','_blank','width=1250,height=800,menubar=yes,scrollbars=yes,resizable=yes');   

The html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:o="urn:schemas-microsoft-com:office:office" lang="en-us" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Expires" content="0" />
<link rel="stylesheet" type="text/css" href="/SiteAssets/reporting.css" />
<title>Untitled 1</title>
</head>
<body>
<div id="printHeader">Reporting</div>
<div id="printBody"></div>
<div id="printFooter">Reporting Footer</div>
</body>
</html>

The popup opens, but I'm then asked if want to download the file. This doesn't happen in a normal asp.net env. So I'm assuming it has something to do whith the way sharepoint sets headers..

So how can I get the popup window to simply render the html?

2 Answers 2

1

Maybe you could use the default sharepoint popup-method?

<a href="javascript:SP.UI.ModalDialog.OpenPopUpPage('/SiteAssets/reportingPrintBase.html');">Do something</a>

You can set these parameters:

SP.UI.ModalDialog.OpenPopUpPage(url, callback, width, height);

With:

  • url: The URL of the page to be shown in the modal dialog.
  • callback: The callback function that runs when the modal dialog is closed.
  • width: The width of the modal dialog.
  • height: The height of the modal dialog.
0

Is the html set up correctly in IIS? Looks like a mime/ content-type related thingie.. If not.. Have you tried another Browser?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.