0

I am using script editor for JSOM which includes java-script and css tags.

My jsom code is working fine only when URL is http://portalurl?PageView=Shared&InitialTabId=Ribbon.WebPartPage&VisibilityContext=WSSWebPartPage

Can any one please help me in knowing what's the issue and how can I solve it?

2
  • what are the webpart properties ? Commented Mar 26, 2018 at 9:00
  • Try adding the type="text/javascript" in the <script> tag references, like this Commented Mar 26, 2018 at 11:12

2 Answers 2

0

edit the page where the web part is placed and select the webpart by checking it, and look for the webpart whether it is minimize/restore. If it is showing option as restore then click on restore and your script may work.

0

It may be the time it takes to load the libraries (like sp.js and your oyher dependencies). When you are in the edit URL it takes more time to load Standard sharepoint components and the your script works. Try to use javascript settimeout (https://www.w3schools.com/jsref/met_win_settimeout.asp) and asks to wait for one second (just as test) if it works use SP.SOD (https://msdn.microsoft.com/en-us/library/office/ff408081(v=office.14).aspx)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.