I have noticed that the javascript in the Content Editor webparts of my SharePoint site have intermittent failures.

The page seems to be ignoring all <script> commands in the CEWP. After a bit of hunting down, I came across the following sites:


Javascript in content editor web part not working after publishing the page

The latter one was most helpful in that it suggested using

http://<site>/SitePages/page.aspx format instead of


(Thanks John M)

This method seemed to consistently fix the errors I had.

If I changed the navigation list down the left hand site to include the full URL in the link path and saved that section, then the full path as it was entered is not saved, but rather SP has replaced the initial part of the URL


with /groups/SitePages/page.aspx

So, even though the _layouts/15... part has been removed, SOD is still active and is still stopping my javascript from executing.

How can I stop the hyperlinks from being replaced in the Navigation section?


This is the code that I am testing with

<script src="https://..../jquery-1.11.3.js"></script>

<script type="text/javascript">
 alert('Script has started');

The alert code is never executed using the Navigation links.

However, if I remove the first line (<script src=.....), then the alert is always executed in every instance.

1 Answer 1


SOD is not rewriting your URLs.

SharePoint is a Content Management System and will take control of all URLs in CEWPs or Pages that are references to content inside your SharePoint environment.

The beauty is it will update those URLs in CEWPs or Pages if you change the destination.
So if links all over your environment point to Page ThisIsA.aspx and you rename that file to /NowItsB.aspx
SharePoint will update all references

Same applies to Links in the QuickLaunch

What do you put in your CEWP?

<script> tags can load .JS files, not .ASPX files

  • Hi Danny, I realise that SOD isn't rewriting the URLs. My suggestion is that when if the URL does not start with /groups, then this ensures that SOD isn't invoked. I have added my simple test script into my original question. Involving it via the URL always causes the alert to display. The alert is never displayed when using the navigation link.
    – southskies
    Commented Dec 13, 2015 at 22:51
  • I read your explanation as: A CEWP on the page will execute code in it, a click on a QuickLaunch link will not execute it. Do you want to trigger a function (on the page) from a hyperlink in the QuickLaunch? Commented Dec 14, 2015 at 8:40
  • Hi Danny, sorry about the delay - just been away. Yes, I wish to be able to execute functions that are on pages that can be accessed via the QuickLaunch.
    – southskies
    Commented Jan 21, 2016 at 3: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.