2

Custom Quick launch comes from the master page and visible through out the entire site. I used CSS to hide quick launch in some of the pages, But it shows up to the all document libraries and is everywhere. So I want to show the quick launch to only pages from the pages library and want to achieve this using javascript in master page, but the script files are not loading in masterpage.

Can anyone suggest me how to achieve this?

1
  • Do you see any errors in your browser console? How did you reference the script files within the masterpage?
    – HarryB
    Nov 26, 2015 at 23:09

1 Answer 1

6

You can upload your JavaScript file in the Style Library and use the SharePoint:Scriptlink tag in Master Page to load it.

For example:

If you have a js file called YourScriptName.js. Goto Site Contents -> Style Library, create a folder for your custom scripts to lie, and upload the one which you want to use.

Then open up your master page and in the header section add a Scriptlink tag to load the js file.

<SharePoint:Scriptlink ID="Scriptlink9" runat="server" name="~SiteCollection/Style Library/YourFolderName/YourScriptName.js" language="javscript" />

The above tag goes in Master Page.

3
  • Thank you Asad. I tried your tag and it is working fine now at the site collection level. But my javascript files are in site assets of a subsite.How to change the reference to subsite level.
    – Sai
    Nov 27, 2015 at 18:18
  • 1
    how can i add this in seattle.html? Apr 3, 2017 at 10:21
  • @vignesh sharepoint.stackexchange.com/questions/211734/…
    – lex
    Jun 29, 2017 at 15: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.