I am newbie about developing with sharepoint and recently, my boss has assigned me a task, so I had to create a list in sharepoint and that list should be accessed by anonymous users. So far everything is fine and I am able to include and see items on that list. But I am facing a problem that is making me nervous.

If I include a js file (jquery library) in a master page, when I try to access these library as an anonymous user, the browser requests a user and password to access the list.

If I remove the js script from the master page, everything works fine.

Is it not possible to include a js file in a master page, even though I have had enabled anonymous access?

P.s: I enabled anonymous access but just for this specific list.

  • Where are you storing the JS files ? Commented Nov 18, 2014 at 13:22
  • Hi, I am storing the js file in a folder "Scripts". I added this folder in my solution and then I deployed the solution using Visual Studio. When I opened the site with Sharepoint Designer, I can see this folder. Commented Nov 18, 2014 at 13:55

1 Answer 1


There are two things to check:

  1. Anonymous users should have access to the library where you are storing JS files otherwise SharePoint will ask for credentials
  2. JS files are checked-in and published
  • The js files are all checked-in and published. The thing is that I guess i should had set this folder for anonymous access, or perhaps include this and also other js files in library also with anonymous access, as sugested above. Commented Nov 18, 2014 at 14:06
  • If you are deploying files using Visual Studio, you can deploy them in Layouts folder and reference from there (/_layouts/folderName/fileName.js). This will not require giving any permissions to Anonymous users Commented Nov 18, 2014 at 14:15
  • I thought the same thing, but as I am going to repeat this scenario at Office365, I do not know if it will work. This solution must work on Sharepoint Server and Sharepoint Online. What I thought is to create a separated library and set it with anonymous access and then store the js files. Commented Nov 18, 2014 at 14:25
  • You are right, AFAIK in Office 365 layouts folder is not accessible for deployment Commented Nov 18, 2014 at 14:31

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.