During the migration of SP2013 farm to SPO I came across a content editor web part which has linked html file containing the following script

<script type="text/javascript">
    function loadJs(path) {
        document.write('\x3Cscript type="text/javascript" src="' + path + '">\x3C/script>');
    function loadCSS(path) {
        document.write('\x3Clink rel="stylesheet" type="text/css" href="' + path + '">\x3C/link>');

    loadCSS(_spPageContextInfo.siteServerRelativeUrl + '/_catalogs/masterpage/Applets/StockTicker/Content/App.min.css');

    loadJs(_spPageContextInfo.siteServerRelativeUrl + '/_catalogs/masterpage/Applets/StockTicker/Scripts/AppletConfig.js');

    loadJs(_spPageContextInfo.siteServerRelativeUrl + '/_catalogs/masterpage/Applets/StockTicker/Scripts/App.js');

<script  type="text/javascript">
    jQuery(document).ready(function () { SP.SOD.executeFunc("sp.js", "SP.ClientContext", function () { Insite.StockTicker.StockTickerFactory.create(); }); });

When I try to load the web part the console gives me an error that .create method could not be found since Insite.StockTicker.StockTickerFactory is undefined. App.js is the file containing the Insite.StockTicker and all its methods. I did a bit of research and found one similar problem where it was suggested to load these files in the exact order.

<script src="/_layouts/1033/init.js" type="text/javascript"></script>
<script src="/_layouts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="/_layouts/sp.core.js" type="text/javascript"></script>
<script src="/_layouts/sp.runtime.js" type="text/javascript"></script>
<script src="/_layouts/sp.js" type="text/javascript"></script>

I am aware that SPO and SP2013 are different but can someone explain to me why the web part works on SP2013 and not on SPO. Correct me If I'm wrong but as far as I understood those scripts are preloaded in SPO and I only have to reference them where needed - in my case in the linked html file.

  • 1
    Can you find out which file/script contaisn the Insite.StockTicker.StockTickerFactory object? Is it App.js? chances are you are still missing a reference to some JavaScript file – Denis Molodtsov Apr 27 at 21:42
  • Yes, App.js contains the Insite.StockTicker.StockTickerFactory object, and this was my first though that I am missing some Js file but how to find out which one exactly, since the console is not giving me exact clue and the same web part is working in SP2013? – retro Apr 28 at 6:39

Your Answer

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

Browse other questions tagged or ask your own question.