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 have an issue where I need to load a piece of my SharePoint 2010 site (header, navigation/search) into another .html page. In general, I want it to look like the following:

<!doctype html>
<HTML>
  <HEAD>  </HEAD>
  <body>

  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

   <div id="HeaderFrame">
      test
   </div>

   <script language="javascript">
    // index.html would be replaced with main sharepoint 2010 page to load //
     $("#HeaderFrame").load("index.html");
   </script>

   <iframe id="DashboardiFrame" scrolling="no" name="dashboard" frameBorder="0" src="blank.html">
      <p>Your browser does not support iframes.</p>
   </iframe>

 </body>
</HTML>

I can't seem to get the notation correct (or something). I always get the

_spBodyOnLoadFunctionNames' is undefined

error.

I'm up for any options to get this to work.

share|improve this question
2  
Why not just use the Page Viewer Web part and have it include Index.html rather than try to shoehorn the SharePoint chrome into a place it doesn't normally run? –  Dave Wise Feb 25 '13 at 17:26
    
Is this html page going to be hosted on whatever sharepoint environment site you are trying to grab from? –  andrew.petersen15 Mar 5 '13 at 0:11

1 Answer 1

jQuery.load allows you to pass in a selector to into the url. So you can grab just the top nav bar with something like the following:

$("#HeaderFrame").load("/sharepointsite/default.aspx .s4-tn")

However, that will likely throw some script errors (just like you described) because none of the sharepoint javascript will be loaded on your custom html page. Plus it will look silly since you won't have any of the SharePoint css loaded either. Your best shot is to try loading the sharepoint page's header, then load your topnav(or whatever piece you're after).

//1.Load the SharePoint head  
$("head").load("/sharepointsite/default.aspx head").done(function(){
    //2. Load the SharePoint top nav
    $("#HeaderFrame").load("/sharepointsite/default.aspx .s4-tn");
});
share|improve this answer

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.