I have a JS that displays something in a page, when I login as a Reader, it doesnt display anything (when I debug the JS using IE Dev tools, it runs but ends at some point)

But when I login as a contributor or higher, the JS code performs well.

The JS is in my SiteAssets and I tried moving it to Style Library and publishing it and still the same, I also moved it to Layouts and still the same.

  • 1
    Can you please post your JS code? If not then can you write what its doing? Also what do you mean by ends at some point does it throws any error or something else? You will have to provide some more information. – Asad Refai Sep 30 '15 at 6:38
  • Please provide code – Taran Goel Oct 1 '15 at 5:21
  • $j(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(test, "SP.js"); }); function test() { processRefiners(); } function processRefiners() { var refDiv = $j('#Refiner').html(); $j('#Refiner').append(""); $j('#RefinerPanel').html(refDiv); $j('#searchBar').show(); } basically the code just appends some checkboxes and texts into a div – Aventus Oct 1 '15 at 5:36
  • 1
    Why would people vote down my question, as if they know everything? – Aventus Oct 2 '15 at 3:08

Though you should write the JS code here but I can safely assume that your JS is accessing some list on which the user don't have permission. It's not about the permission on JS file it's al about the permission on the resources your JS file is trying to access.

| improve this answer | |
  • Agree with Taran. See if you are writing any CSOM code to fetch data from lists. – Anand Sep 30 '15 at 4:21
  • In my masterpage, there is a div that is hidden style="display:none" and in the JS, this is being shown by the JS. Is there an impact here? – Aventus Sep 30 '15 at 7:07
  • User is able to see masterpage? – Taran Goel Sep 30 '15 at 8:29
  • Yes, reader can see the masterpage – Aventus Oct 1 '15 at 0:29
  • Is there a condition on which it should be visible or hidden? – Taran Goel Oct 1 '15 at 5:21

I solved my problem by using executeFunc instead of ExecuteOrDelayUntilScriptLoaded

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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