Dojo loader - loading from remote location

04-23-2018 08:48 PM
Occasional Contributor II

I'm trying to load a file from a remote location. The file is from Github: bowser/src at master · lancedikson/bowser · GitHub. I've put the bowser.js file in a remote file storage location.  My HTML file contains this.

        var dojoConfig = {
            async: false,
            parseOnLoad: true,
            packages: [{
                "name": "bowser",
                "location": "https://domain/maps/playgrounds/js/bowser"
    <script src=""></script>
    <script src="https://domain/maps/playgrounds/js/playgrounds.js"></script>
    <script src="https://domain/maps/playgrounds/js/bowser/bowser.js"></script>‍‍‍‍‍‍‍‍‍‍‍‍‍

The playgrounds.js file is the file that loads the packages and instantiates the map.

The require looks like this:

require([bowser], function(bowser){

This all works and the bowser methods are accessible. However, I get this error in the console and can't see why.

0 Kudos
2 Replies
MVP Esteemed Contributor


  So you have a couple of things that are trowing me off here.

  1. You are use the bowser.js in the html because of this 
     <script src="https://domain/maps/playgrounds/js/bowser/bowser.js"></script>
  2. Then you are defining the package too.

You likely do not need the script tag in #1 when you are using the package. Next the package you are using in the html is just defining the package folder as browser and in the playgrounds.js you are attempting to use it 

require([bowser], function(bowser){

it should be:

require([bowser/bowser], function(bowser){

because browser is just the package name and you did not specify the file name it defaults to looking for main.js.

Occasional Contributor II

Hi Robert, thanks for you reply. I tried your solution, but that resulted in bower not being instantiated. I think that maybe the bower.js is not a package file. Long story short: I found another way of doing what I needed without calling any bower functions. So I now have no need for bower.js in my app. I ran out of time to learn about packages and dojo loader. I have successfully used bower.js in a WAB custom widget though.

0 Kudos