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?
-
Do you see any errors in your browser console? How did you reference the script files within the masterpage?– HarryBNov 26, 2015 at 23:09
1 Answer
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
.
-
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.– SaiNov 27, 2015 at 18:18
-
1
-