NS_ERROR_DOM_BAD_URI: Access to restricted URI denied

19464
9
03-24-2016 04:37 AM
BryanKarlsson
New Contributor

Im following this guide:

https://developers.arcgis.com/javascript/jshelp/intro_agstemplate_amd.html

I am using the Web Map ID that they do In the tutorial: 1a40fa5cc1ab4569b79f45444d728067

However, when I run my code:

var map;
require([
"esri/map",
"esri/arcgis/utils",
"dojo/domReady!"
], function(Map, arcgisUtils) {
  arcgisUtils
.arcgisUrl = "file:///C:/Users/Bryan/Desktop/gis.html";
  arcgisUtils
.createMap("1a40fa5cc1ab4569b79f45444d728067 ", "mapDiv").then(function(response) {
  map
= response.map;
  
});
});

I get the following error:

NS_ERROR_DOM_BAD_URI: Access to restricted URI denied

In the tutorial they say the following:

To access a web map from a portal outside of ArcGIS Online, reference the arcgisUrl property and set the path to your portal URL before calling the createMap() method: arcgisUtils.arcgisUrl = "http://pathto/portal/sharing/content/items";

But what is a portal URL? What Is my Portal URL? Anyone who can help me?

0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Emeritus

Bryan,

  Portal is an on-premise instance of ArcGIS Online. If you had portal install you would more than likely know it and know what Portal is. How do you access your web map now? what is the url you use to access it?

0 Kudos
BryanKarlsson
New Contributor

Okey. Thank you for your answer. I created a account on http://www.arcgis.com/features/  and created a map there. But I don't know how to access It so I can follow the tutorial..

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bryan,

  So it sounds like you signed up for a trial version of ArcGIS Online. If that is the case then you have an AGOL account and your content is available in the my content section/tab of your AGOL account. Here is an example of one of my web maps using my AGOL account (you will not be able to view it though as you are not a part of my organization):

http://calhoun.maps.arcgis.com/home/item.html?id=10a7e8fdb0fe4e869659d1bc4cc0be7d

So notice at the begining of the url my origanization. So when you view your web map using the AGOL map Viewer you will see a similar url in your browsers address bar. So your arcgisUrl would be that very first http://xxxx.maps.arcgis.com.

0 Kudos
BryanKarlsson
New Contributor

Thank you

But no I just get a error:

Any Idea what this mean?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bryan,

  Can you show the complete code you are trying?

0 Kudos
BryanKarlsson
New Contributor

<!DOCTYPE html>

<style>

  html, body, #mapDiv {

    padding: 0;

    margin: 0;

    height: 100%;

  }

</style>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">

    <title></title>

    <link rel="stylesheet" href="https://js.arcgis.com/3.16/esri/css/esri.css">

    <script src="https://js.arcgis.com/3.16/"></script>

  </head>

  <body class="claro">

    <script>

        var map;

        require([

        "esri/map",

        "esri/arcgis/utils",

        "dojo/domReady!"

        ], function(Map, arcgisUtils) {

            arcgisUtils.arcgisUrl = "http://consid.maps.arcgis.com/";

            arcgisUtils.createMap("e682e2f2bfff4cf2918190a8b3e44087 ", "mapDiv").then(function(response) {

                map = response.map;

            });

        });

    </script>

   

    <div id="mapDiv">

    </div>

  </body>

</html>

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bryan,

  Sorry for mis-directing you. Because your web map is on AGOL and NOT Portal then you do not need the arcgisUrl line

        //arcgisUtils.arcgisUrl = "http://consid.maps.arcgis.com/";
            arcgisUtils.createMap("e682e2f2bfff4cf2918190a8b3e44087 ", "mapDiv").then(function(response) {
                map = response.map;
            });
0 Kudos
BryanKarlsson
New Contributor

No, that don't work:

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bryan,

  This code worked fine for me:

<!DOCTYPE html>
<style>
  html, body, #mapDiv {
    padding: 0;
    margin: 0;
    height: 100%;
  }
</style>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <title></title>
    <link rel="stylesheet" href="https://js.arcgis.com/3.16/esri/css/esri.css">
    <script src="https://js.arcgis.com/3.16/"></script>
  </head>
  <body class="claro">
    <script>
        var map;
        require([
        "esri/map",
        "esri/arcgis/utils",
        "dojo/domReady!"
        ], function(Map, arcgisUtils) {
            arcgisUtils.createMap("e682e2f2bfff4cf2918190a8b3e44087 ", "mapDiv").then(function(response) {
                map = response.map;
            });
        });
    </script>
    <div id="mapDiv">
    </div>
  </body>
</html>

You are not trying to run the page from the file system are you like "file:///C:/blahblah.html"?

0 Kudos