HOW TO
This article describes how to add bookmark functionality to an ArcIMS website. This functionality will allow users to bookmark the whole ArcIMS website or a particular extent, which respects the visible layers and active layer settings of that extent.
The procedure shows how to implement example bookmark code in a 'vanilla' or out of the box HTML viewer.
Note:
Though the included sample code can be implemented in all browsers, the functionality will only work with Internet Explorer. For all the other browsers, the bookmark option is not shown.
Code:
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
document.writeln(theTitle);
</SCRIPT>
</B></FONT>
</BODY>
</HTML>
Code:
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
if (window.external) { // Check for browser - IE only
document.writeln('<span onclick="javascript:bookmarkExtent();" style="cursor:pointer;">[ Bookmark Extent ]</span>');
document.writeln('<span onclick="javascript:bookmarkSite();" style="cursor:pointer;"> [ Bookmark Site ]</span>');
}
</SCRIPT>
Code:
function showInfo() {
if (parent.TextFrame!=null) {
parent.TextFrame.document.location="arcimsInfo.htm";
} else {
var Win1 = open("arcimsInfo.htm","InfoWindow","width=575,height=150,scrollbars=yes,resizable=yes");
}
}
</SCRIPT>
</HEAD>
Code:
function bookmarkExtent() {
var t=parent.MapFrame;
var bmExtent = "?box="+t.eLeft+":" + t.eBottom + ":" + t.eRight + ":" + t.eTop;
var bmLayers = "&Layers=" + getLayersVisibilityStatus();
var bmActiveLayer = "&ActiveLayer=" + t.ActiveLayerIndex;
//Change the site to reflect your website entry page
var site = "http://nandi/website/test/default.htm";
// Change the title if needed
var title = "NorthAmerica Saved Extents";
if (window.external) // IE
window.external.AddFavorite(site+bmExtent+bmLayers+bmActiveLayer,title);
}
function bookmarkSite() {
// Change the title if needed
var title = "NorthAmerica - ArcIMS Map Service";
// Change the site to reflect your webite
var site = "http://nandi/website/test/default.htm";
if (window.external) // IE
window.external.AddFavorite(site, title);
}
function getLayersVisibilityStatus() {
var t=parent.MapFrame;
var visibleLayers = "";
for (var i=0;i<t.layerCount;i++) {
if (t.LayerVisible[i]==1)
visibleLayers += "1";
else
visibleLayers += "0";
}
return visibleLayers;
}
Code:
//Change the site to reflect your website
var site = "http://nandi/website/test/default.htm";
Article ID:000008107
Get help from ArcGIS experts
Download the Esri Support App