0

I have a custom JS file located in siteassets in the homesite https://companyxxx.sharepoint.com/SiteAssets/scripts/custom.js

I have added this JS file in the masterpage of one of my collections and its working ("executing") fine when collection owners or members are coming to the collection but this file is not loading for collection Visitors.

What setting should I change for Visitor group for them to load and run this JS file?

4
  • 3
    did you publish your JS??? If you dont publish the file, only admins can execute it.
    – Marco
    Commented May 2, 2016 at 17:41
  • It depends on what the script is doing, they should be able to read in the file and have it "execute" but it depends what the script is doing will determine what will happen. If it is trying to add or update information, then they need the associated rights on those objects to do it. Commented May 2, 2016 at 17:42
  • @Marco, The JS files are published. Commented May 4, 2016 at 16:57
  • @EricAlexander, The JS file doesnt access any list info. it does add few CSS changes to the HTML using jQuery. Commented May 4, 2016 at 16:59

2 Answers 2

1

Looks like we forgot to publish the master pages in our target collections where we added the script tags. Once the master page got published, everything started working as expected.

0

I believe it is a publishing issue as Marco has mentioned. The way to debug it though is to try to log as a user from the visitor group and using the developer tools and see the version of your custom.js file and compare to another user from the owners group. personally, It happens to me couple of times, and I ended up just adding comments to the js file (SP is smart enough to not update the version number if no real changes happened to the file being published) and then republished. I am sure it will work afterwards. Good Luck!

3
  • The custom.js file is not loading at all for visitors but is loading fine for other groups. I am using different browsers and their developer tools to check for that file but no luck for visitor accounts. Commented May 4, 2016 at 20:41
  • so no loading means they have not permission to the file. when you check Shared With (providing it is 2013) and go to advanced, can you verify if the visitor group got access? Also, if you log in with a visitor account, and try to access the URL in the browser (copy paste the url in the browser window), what do you get? Commented May 4, 2016 at 21:19
  • The Visitor account can access the JS file separately in the browser. Also if I make the visitor a member in the target collection, the JS file gets executed without any issues. Commented May 4, 2016 at 21:40

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.