none
Adding a ScriptEditor web part to a page RRS feed

  • Question

  • Hi,

    I'm trying to add a JS script to a page. I inserted a ScriptEditor web part but I have difficulties with copying and pasting the actual JS script. This is what I see on the page:

    There is no Properties window. In fact, all the buttons on the Web Part tab are grayed out.

    I have Full Access to the page and I also belong to the Designer and Administrator groups. Besides, if it was a permission problem how I would be able to add the web part at first place? It's really weird. Now, I'm not even able to remove the web part.

    What should I do to make it work?

    Thanks,

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Tuesday, May 2, 2017 7:52 PM

All replies

  • Hi,

    You need to enable scripting.

    https://blogs.msdn.microsoft.com/sridhara/2015/04/02/the-new-custom-script-no-script-feature/


    Please remember to click Mark as Answer on the answer if it helps you

    Tuesday, May 2, 2017 8:32 PM
  • Thanks Lakshmanan for your response. I don't think enabling scripting is relevant in my situation. I have a problem with editing a web part, not running the script. Besides, the post you pointed out is for O365 SharePoint. I'm using SP on-premises (enterprise edition).

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Tuesday, May 2, 2017 9:28 PM
  • Hi,

    Do you have any other custom logic in this page?

    You could delete the web part by adding ‘?contents=1’ to the page, so you could redirect to Web Part Page Maintenance page.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, May 3, 2017 4:52 AM
  • Thanks Lee. No, I don't have any other custom logic on the page, just a bunch of other web parts such as Promoted Links. I was able to redirect to the WebPart Maintenance page and delete the Script Editor web part.

    Now, back to my question: How to add a JS script to the Script Editor web part? All what I see is a small glyph in the right-top corner that just hides and shows the web part:

    Thanks,

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Wednesday, May 3, 2017 2:27 PM
  • Hi,

    Could you try with content editor web part?

    If content editor web part works fine, you could add script to content editor web part.

    If content editor web part still issue, try to use developer tool to check the difference between a page which script/content editor web part works fine.

    If need future assistance, try to post the page code by going to SharePoint Designer so I could try to test in my local.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, May 4, 2017 1:28 AM
  • Thanks Lee for your response.

    The Content Editor web part has the same issue - I'm only able to collapse/expand the web part but not edit it:

    The page is fine, there is no problem with the page itself. The problem seems to be with permissions: I can only add/remove web parts but not edit them.

    What permissions should I have to be able to edit web parts and how to grant these permissions? 

    Thanks,

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Thursday, May 4, 2017 8:02 PM
  • Hi,

    As you’re in site Administrator groups so it should not be permission issue( you could edit the page and insert other webparts, right? ).

    Could you test whether script editor/content editor work fine if you delete other webparts?(or create another similar page and test)

    Have you custom master page/use custom page  layout?

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, May 9, 2017 8:08 AM
  • Thanks Lee for your response.

    Answering your questions:

    1. The script/content editor exhibits the same behaviour: there is only expand/collapse button in the top-right corner of the web part. I'm not able to access the Web Part Properties window.

    2. No, I don't have a custom master page. There are no custom js scripts on the page either.

    Thanks,

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Wednesday, May 10, 2017 1:27 PM
  • Hi,

    What’s the browser you’re using? Have you tried other browser?

    For troubleshooting the issue, you could try to search the DOM by developer tool and check does the menu loaded or not.

    As a workaround, you could try to add your JavaScript code to the page by SharePoint Designer.

    For example:

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com


    Friday, May 12, 2017 12:57 PM
  • Hi Lee,

    I has turned out it is a browser problem. I opened the page in Google Chrome and I was able to edit the properties of the ScriptEditor web part. I'm using Internet Explorer 11. It's weird though as I'm opening the same page in the same browser but installed on a different server and I'm able to edit properties by clicking an icon in the ribbon's Web Part tab (it's greyed out when pull the page from another server). I guess there must be a setting somewhere in SharePoint that configures that. Not being an admin I have no idea where to look.

    This is what I see in IE 11 on the server that does not work, no js-webpart-menuCell element:

    It's similar to what I get from the server that works except the buttons on the ribbon's WebPart tab are not greyed out and I'm able to edit properties of the ScriptEditor web part.

    My client uses IE 11. Before I ask them to stop using it and switch to Chrome (I'm afraid that they may refuse to do that), I'd like to clarify why the page works on one server and it does not work on another. Where should I start to look?

    Thanks,

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Friday, May 12, 2017 1:46 PM