2

I wanted to Insert JavaScript automatically to new pages added to SharePoint wiki library. Instead of users manually adding the script to each page, it should be present by default or added programmatically. Any ideas on what would be the best way to do this?

3
  • 2
    Is there some limitation that prevents you to put your script inside your masterpage? It would be "automatically" applied to every page. Commented Apr 15, 2016 at 16:55
  • I would use a custom user action on the master page if you are ok with the JavaScript loading across the site. Commented Apr 16, 2016 at 14:59
  • Can we apply a separate master page for wiki pages or it would have to be a common master page?
    – spdev
    Commented Apr 18, 2016 at 15:03

1 Answer 1

0

You should be able to have a custom page template in your wiki library which has the Javascript added to it. So when you add a new page using this template, it too would have the Javascript.

I could not find any good articles on this, however if you are not aware of the process, this one should get you started on how to create a wiki page template.

I am not sure if this would be the best possible solution though.

1
  • Thanks. I have to wait until I get access to the development env to try this. Currently I am doing the POC in a SharePoint online environment.
    – spdev
    Commented Apr 18, 2016 at 15:05

Your Answer

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

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