0

I have included a js file in the content editor but it runs in the edit mode only. I have tried all the suggestions like

  1. Including text/javascript
  2. Include code between execfunc()

But it still doesn't work. Can someone please help me with this?

  • In editmode sharepoint loads many of the files like sp.js etc. What is the execfunc() you are calling? – Anders Aune Feb 13 '15 at 8:58
  • var ctx = new SP.ClientContext.get_current(); – Keerthi Feb 13 '15 at 14:47
0

Did you put the code directly inside the Content Editor? If so, try putting the code in a file in a document library and linking it to the Content Editor.

Another thing to check is if Minimal Download Strategy (MDS) is causing an issue. When the code is not working, does the URL contain "_layouts/15/start.aspx#"?

  • Thanks @Rob Windsor. I have put the code in a js file under Site Assets and included the script tags in content editor. And also the URL looks like this - "SitePages/Home.aspx" – Keerthi Feb 11 '15 at 20:32

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.