locked
master page and java script RRS feed

  • Question

  • How i can use java script code in master page

    How to add reference of a website into the java script file?

    • Moved by Mike Walsh FIN Thursday, July 7, 2011 10:24 AM master page = customization (From:SharePoint - General Question and Answers and Discussion (pre-SharePoint 2010))
    Thursday, July 7, 2011 7:35 AM

Answers

  • The recommended way to add Javascript to Master Page is to leverage <SharePoint:ScriptLink > attribute. You could have the physical javascript files living in either layouts\1033 folder or the SharePoint libraries

     


    Sundar Narasiman
    Thursday, July 7, 2011 12:45 PM

All replies

  • It's no different to using JavaScript normally, stick the file somewhere and then reference it, although I'd suggest not editing any of the packaged Microsoft Master Pages.
    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/
    Thursday, July 7, 2011 7:52 AM
    Answerer
  • Hi,

    method(1)  :copy the script into layouts\1033 folder and give reference like this

    <SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server"/>

    method(2)  :open master page in share poinr designer and add the script into the master pages itself.

    Regards,

    sukku

    Thursday, July 7, 2011 11:56 AM
  • The recommended way to add Javascript to Master Page is to leverage <SharePoint:ScriptLink > attribute. You could have the physical javascript files living in either layouts\1033 folder or the SharePoint libraries

     


    Sundar Narasiman
    Thursday, July 7, 2011 12:45 PM