Dojo loader error - David Spriggs Widget

2657
1
01-06-2016 01:38 PM
AlexGole
Occasional Contributor II

Hi all,

I am trying to use a great Print widget created by David Spriggs in my web app. Although it works great, from time to time, I get a dojo loader error thrown at me. I noticed the same error on his github. A pic of the error I get in debugger is attached below.

Script is following:

<script>
        var dojoConfig = { isDebug: true };
    </script>
    <script type="text/javascript">
        var dojoConfig = {
            async: true,
            packages: [{
                name: "gis",
                location: location.pathname.replace(/[^\/]+$/, '') + "Widget/Print/gis/"
            }, {
                name: "dbootstrap",
                location: location.pathname.replace(/[^\/]+$/, '') + "Widget/Print/dbootstrap"
            }, {
               name: "xstyle",
               location: location.pathname.replace(/[^\/]+$/, '') + "Widget/Print/dbootstrap"
            },
            {
                name: "agsjs",
                location: location.pathname.replace(/[^\/]+$/, '') + "Widget/toc/2.10/src/agsjs/"
            }
            ]


        };
    </script>

Any idea what's wrong?

Thank you,

Alex

0 Kudos
1 Reply
JeffJacobson
Occasional Contributor III

Since this project is on GitHub, and the error occurs on the project's demo site, I would recommend you create a new issue on the project's issues page.

I think the issue is the regular expression used with the location.pathname.replace function.

If you put index.html at the end of the URL, the error seems to go away.

You'll need to find a regular expression that works with both the index.html URL and one that works with the default (no index.html) URL. This may work for you: GeoPortal/index.html at master · WSDOT-GIS/GeoPortal · GitHub

Dojo error

http://davidspriggs.github.io/print-widget-js/

vs.

No Dojo error

http://davidspriggs.github.io/print-widget-js/index.html

0 Kudos