hi all, I'm trying to set up my very first web page using the Javascript API. Just copied and pasted the code from ESRI's "Build your first application" into a text editor, saved it as an .htm document (careful NOT to have a .txt suffix), and put in on my web server. But when I open that .htm file in my browser as a URL, it just displays the plain text of the code in the .htm file. It's not showing the map or reading/interpreting the HTML and Javascript code to get that content. So what am I missing here? Thanks for any help.
Dan
Solved! Go to Solution.
Here is exactly how you do it. I recorded my screen and explained it in this video:
Can you share the code you wrote? Also besides the suffix you should save file as type to all files. Some text editors default to text document and you don't want that.
thanks Chris. Here it is:
<!DOCTYPE html>
<html>
<head>
<title>Create a Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="http://js.arcgis.com/3.12/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.12/esri/css/esri.css">
<style>
html, body, #mapDiv{
padding: 0;
margin: 0;
height: 100%;
}
</style>
<script src="http://js.arcgis.com/3.12/"></script>
<script>
var map;
require(["esri/map", "dojo/domReady!"], function(Map) {
map = new Map("mapDiv", {
center: [-56.049, 38.485],
zoom: 3,
basemap: "streets"
});
});
</script>
</head>
<body class="claro">
<div id="mapDiv"></div>
</body>
</html>
Here is exactly how you do it. I recorded my screen and explained it in this video:
thanks Chris and everyone, got it!
Can you please share your code..
probable issues..
1. is your JS files are in right path ?
2. is your REST end point correct ?
Thanks,
Venkat
Hi Dan,
Can you upload the htm file, or copy/paste the code you used? If you copy/paste, take a look at this post on how to do so in GeoNET:
I had no problems with your code. Are you opening it with a browser?
yes, in both Firefox and IE. I assumed maybe I was leaving out some basic step, but apparently not...might be some setting I need to change in my browser?