Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.
share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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