4

JavaScript stops working and Masterpage seems to lose all styles.

There are 3 places where a converted .html Masterpage references the original URL/Domain the site was created in.

  1. <mso:_dlc_DocIdUrl msdt:dt="string"></mso:_dlc_DocIdUrl>
  2. <mso:HtmlDesignFromMaster msdt:dt="string"></mso:HtmlDesignFromMaster>
  3. <mso:HtmlDesignStatusAndPreview msdt:dt="string"></mso:HtmlDesignStatusAndPreview>

This can cause problems if you have a development environment with a different URL/Server name than the production environment.

I've seen a reference to this in one place: The 3rd comment references this problem and how it was fixed. Has anyone else encountered this?

At first, it seemed the Masterpage was breaking because somehow there was a duplicate meta tag added upon conversion.

 <!--CE: End Page Head Contents Snippet-->
        <meta http-equiv="X-UA-Compatible" content="IE=10" />
        <meta name="GENERATOR" content="Microsoft SharePoint" />
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <meta http-equiv="Expires" content="0" />

Once I removed the duplicate tag, the Masterpage worked again. But now, it's broken again and JavaScript doesn't work...

Any ideas on troubleshooting will be helpful

The suggested way to upload JavaScript files in SP Server 2013 is using the mapped network drive from design manager, yet, several people have mentioned there are different locations where JS files can be loaded and some continue to use 2007 and 2010 methods.

  1. (2013) Using the JSLink Method

    <SharePoint:ScriptLink language="javascript" name="~sitecollection/assets/js/jquery.js" runat="server" OnDemand="False" LoadAfterUI="True" />
    
  2. (2010) Load to: /_LAYOUTS/CustomScript or /_LAYOUTS/15/CustomScript

  3. (2007/2010) 'Script Link' method /_LAYOUTS/1033 StackExchange Question: Unable to reference jQuery inside my master page
  4. (2010) 'Custom Action' method

I wonder that when the server name and internet url are different, if this would require using one of these different methods?

11
  • 1
    In my opinion, this post just doesn't provide enough information for anyone to help you. Javascript can stop working because of unhandled exception. Did you look at IE Developer Tools or Chrome Developer Tools while loading page? any errors? How do you build masterpage? Using Desginer Manager -> Editing associated .html file ? Aug 31, 2014 at 18:39
  • Thanks - as mentioned in my post, I use Design Manager "...a converted .HTML Masterpage..." I use Firefox developer tools and there were no errors for the JavaScript because it didn't load in the browser... what other questions did you have?
    – Mia
    Sep 3, 2014 at 22:15
  • This bounty was not helpful - can I have my points back?
    – Mia
    Sep 3, 2014 at 22:16
  • 1
    You've just lost points? hmm..interesting. If you check .html file - (go to Edit properties on List Items) what values do ContentType and AssociatedFile columns have? Sep 4, 2014 at 18:46
  • 1
    You are probably doing a Design Package and then "deploying" it to production environment? Try just Mapping network drive and then copy/paste .html/css/js - change Content Type on .html file Sep 4, 2014 at 20:56

1 Answer 1

1

I would first check to see if the js and css script and link tags are present in the browser. Load your site in the browser and view source. Can you find valid tags that should be telling the browser to request the css and js files?

Next, use Fiddler or the net tab in Firebug and reload your page again. Are the css and js files actually being requested by the browser? I have to assume not, but if they are, now you need to figure out why they are not being used.

Still stuck? open up your HTML Master Page's associated .master Master Page in SPD. You can open this without problems, SP will just not let you save it. That is ok. What you are looking for is link, script and/or cssregistration tags within your .master that correspond to your link and script tags in your HTML Master Page. It may be that Design Manager is stripping your tags for some yet to be determined reason.

Let me know what else you find.

4
  • thanks for your input here. It was really nice to meet at you at SPSaturday San Diego! 1. View source: Javascript file is not there 2. NET View in Firefox developer tools - Javascript file is not there. 3. .MASTER page view in SPDesigner not found for the Javascript file I've linked in the correspdonding HTML file 4. MASTER.HTML file - Javascript IS linked before </HEAD> tag
    – Mia
    Dec 1, 2014 at 17:37
  • I am thinking that because the server name is different from the site url. The mapped network drive points to the site url. Is this anywhere in SP documentation? link
    – Mia
    Dec 1, 2014 at 17:56
  • Please note: I updated my question with different methods which are used to 1. Load JS in SP Server and 2. Link JS from masterpage or since 2013, HTML
    – Mia
    Dec 1, 2014 at 19:08
  • Getting there... wictorwilen.se/… chuvash.eu/tag/minimal-download-strategy sharepointannoyances.wordpress.com/tag/scriptlink/ edinkapic.com/2013/09/… gsoft.com/en/blog/…
    – Mia
    Dec 5, 2014 at 19:52

Your Answer

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

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