Arthur, I am not a big Chrome fan so I don't know any more than what I Google on the net.
Arthur, The mailto handling is browser specific and can be altered by the end users preference changes in the browser or a corporations IT restrictions. The user can change how mailto: links behave in chrome by visiting chrome://settings/handlers, or Chrome Settings->Content Settings->Manage Handlers...
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:viewer="com.esri.viewer.*"> <fx:Script> <![CDATA[ import com.esri.ags.geometry.MapPoint; import com.esri.ags.utils.WebMercatorUtil; import mx.controls.Alert; private function mailme():void { var currentCenter:MapPoint = (map.extent.center) as MapPoint; var u:String = ""; u+= "mailto:email@address.com"; u+= "?"; u+= "subject="; u+= emailSubject.text; u+= " "; u+= "&body=http://my_url/index.html?center=" + myDegreeFormatter.format(currentCenter.x) + "," + myDegreeFormatter.format(currentCenter.y) + "%26" + "scale=" + Math.round(map.scale) + "%0D%0A" + "%0D%0A" //Creates two blank lines + emailComment.text; var url:URLRequest= new URLRequest(u); navigateToURL(url, "_self"); } private function getURLParameters():Object { var result:URLVariables = new URLVariables(); try { if (ExternalInterface.available) { // Use JavaScript to get the search string from the current browser location. // Use substring() to remove leading '?'. // See http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html var search:String = ExternalInterface.call("location.search.substring", 1); if (search && search.length > 0) { result.decode(search); } } } catch (error:Error) { Alert.show(error.toString()); } return result; } private function setMapLocation():void { var params:Object = getURLParameters(); if (params["ll"]) { var latlong:Array = String(params.ll).split(","); if (latlong.length == 2) { map.centerAt(new MapPoint(latlong[1], latlong[0])); } } if (params["scale"]) { map.scale = params.scale; } } ]]> </fx:Script> <fx:Declarations> <mx:NumberFormatter id="myDegreeFormatter" precision="0" useThousandsSeparator="false"/> </fx:Declarations> <viewer:WidgetTemplate id="passURL" widgetTitle="Pass URL" width="100%" height="100%"> <s:VGroup id="groupURL"> <s:Label text="Subject ID: "/> <s:TextInput id="emailSubject" width="300"/> <s:Label text="Comment: "/> <s:TextArea id="emailComment" width="300" height="400" text ="I have a question."/> <s:Button click="mailme()" fontSize="14" fontWeight="bold" label="Email Us"/> </s:VGroup> </viewer:WidgetTemplate> </viewer:BaseWidget>
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:viewer="com.esri.viewer.*"> <fx:Script> <![CDATA[ import com.esri.ags.geometry.MapPoint; import com.esri.ags.utils.WebMercatorUtil; import mx.controls.Alert; [Bindable] private var EmailComment:String; // Sends data to email file // Ref: http://forums.arcgis.com/threads/41459-Create-Email-with-Hyperlink-to-share-map-extent // Ref: http://stackoverflow.com/questions/6841136/mailto-with-attachments-in-flex-or-air-applications // Ref: http://zoomquiet.org/res/scrapbook/ZqSKM/data/20100419224556/ private function mailme():void { var currentCenter:MapPoint = (map.extent.center) as MapPoint; var u:String = ""; u+= "mailto:mappers@site.com"; u+= "?"; u+= "subject="; u+= emailSubject.text; u+= " "; u+= "&body=http://url/siteweb/?center=" + myDegreeFormatter.format(currentCenter.x) + "," + myDegreeFormatter.format(currentCenter.y) + "%26" + "scale=" + Math.round(map.scale) + "%0D%0A" + "%0D%0A" //Creates two blank lines + emailComment.text; var url:URLRequest= new URLRequest(u); navigateToURL(url); } private function getURLParameters():Object { var result:URLVariables = new URLVariables(); try { if (ExternalInterface.available) { // Use JavaScript to get the search string from the current browser location. // Use substring() to remove leading '?'. // See http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html var search:String = ExternalInterface.call("location.search.substring", 1); if (search && search.length > 0) { result.decode(search); } } } catch (error:Error) { Alert.show(error.toString()); } return result; } private function setMapLocation():void { var params:Object = getURLParameters(); if (params["ll"]) { var latlong:Array = String(params.ll).split(","); if (latlong.length == 2) { map.centerAt(new MapPoint(latlong[1], latlong[0])); } } if (params["scale"]) { map.scale = params.scale; } } ]]> </fx:Script> <fx:Declarations> <mx:NumberFormatter id="myDegreeFormatter" precision="0" useThousandsSeparator="false"/> </fx:Declarations> <viewer:WidgetTemplate id="passURL" widgetTitle="Pass URL" width="100%" height="100%"> <s:VGroup id="groupURL"> <s:Label text="Subject: "/> <s:TextInput id="emailSubject"/> <s:Label text="Comment: "/> <s:TextArea id="emailComment" maxChars="250"/> <s:Button click="mailme()" fontSize="12" fontWeight="bold" label="Report Error"/> </s:VGroup> </viewer:WidgetTemplate> </viewer:BaseWidget>
http://http://servername/FlexViewer/v23/idea/PAidea/MainProjectv231/index.html?config=config-Basic.xml¢er=-8382590,4857620&scale=9028
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:viewer="com.esri.viewer.*"> <fx:Script> <![CDATA[ import com.esri.ags.geometry.MapPoint; import com.esri.ags.utils.WebMercatorUtil; import mx.controls.Alert; private function mailme():void { var currentCenter:MapPoint = (map.extent.center) as MapPoint; var u:URLRequest=new URLRequest ("mailto:someone@gmail.com?subject=Map Link&body=http://gis.co.wood.wi.us/Flex24/index.html?center=" + myDegreeFormatter.format(currentCenter.x) + "," + myDegreeFormatter.format(currentCenter.y) + "%26" + "scale=" + Math.round(map.scale)) navigateToURL(u,"_self"); } private function getURLParameters():Object { var result:URLVariables = new URLVariables(); try { if (ExternalInterface.available) { // Use JavaScript to get the search string from the current browser location. // Use substring() to remove leading '?'. // See http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html var search:String = ExternalInterface.call("location.search.substring", 1); if (search && search.length > 0) { result.decode(search); } } } catch (error:Error) { Alert.show(error.toString()); } return result; } private function setMapLocation():void { var params:Object = getURLParameters(); if (params["ll"]) { var latlong:Array = String(params.ll).split(","); if (latlong.length == 2) { map.centerAt(new MapPoint(latlong[1], latlong[0])); } } if (params["scale"]) { map.scale = params.scale; } } ]]> </fx:Script> <fx:Declarations> <mx:NumberFormatter id="myDegreeFormatter" precision="0" useThousandsSeparator="false"/> </fx:Declarations> <viewer:WidgetTemplate id="passURL" widgetTitle="Pass URL" width="200" height="100"> <s:HGroup id="groupURL"> <s:Button click="mailme()" fontSize="14" fontWeight="bold" label="Email Map Link"/> </s:HGroup> </viewer:WidgetTemplate> </viewer:BaseWidget>
var u:URLRequest=new URLRequest ("mailto:someone@gmail.com?subject=Map Link&body=http://gis.co.wood.wi.us/Flex24/index.html?center=" + myDegreeFormatter.format(currentCenter.x) + "," + myDegreeFormatter.format(currentCenter.y) + "%26" + "scale=" + Math.round(map.scale)) navigateToURL(u,"_self");
var u:URLRequest=new URLRequest ("mailto:someone@gmail.com?subject=Map Link&body=http://gis.co.wood.wi.us/Flex24/index.html?center=" + myDegreeFormatter.format(currentCenter.x) + "," + myDegreeFormatter.format(currentCenter.y) + "&" + "scale=" + Math.round(map.scale)) navigateToURL(u,"_self");
var request:URLRequest = new URLRequest("mailto:someone@gmail.com?subject=Map Link&body=index.html?center=" + myDegreeFormatter.format(currentCenter.x) + "," + myDegreeFormatter.format(currentCenter.y) + "&scale=" + Math.round(map.scale)) navigateToURL(request,"_blank");
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:viewer="com.esri.viewer.*"> <fx:Script> <![CDATA[ import com.esri.ags.geometry.MapPoint; import com.esri.ags.utils.WebMercatorUtil; import mx.controls.Alert; private function createPermalink():void { var currentCenter:MapPoint = (map.extent.center) as MapPoint; navigateToURL(new URLRequest( "index.html?center=" + myDegreeFormatter.format(currentCenter.x) + "," + myDegreeFormatter.format(currentCenter.y) + "&scale=" + Math.round(map.scale)), "_blank"); } private function getURLParameters():Object { var result:URLVariables = new URLVariables(); try { if (ExternalInterface.available) { // Use JavaScript to get the search string from the current browser location. // Use substring() to remove leading '?'. // See http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html var search:String = ExternalInterface.call("location.search.substring", 1); if (search && search.length > 0) { result.decode(search); } } } catch (error:Error) { Alert.show(error.toString()); } return result; } private function setMapLocation():void { var params:Object = getURLParameters(); if (params["ll"]) { var latlong:Array = String(params.ll).split(","); if (latlong.length == 2) { map.centerAt(new MapPoint(latlong[1], latlong[0])); } } if (params["scale"]) { map.scale = params.scale; } } ]]> </fx:Script> <fx:Declarations> <mx:NumberFormatter id="myDegreeFormatter" precision="0" useThousandsSeparator="false"/> </fx:Declarations> <viewer:WidgetTemplate id="passURL" widgetTitle="Pass URL" width="200" height="100"> <s:HGroup id="groupURL"> <s:Button click="createPermalink()" fontSize="14" fontWeight="bold" label="Create a hyperlink"/> </s:HGroup> </viewer:WidgetTemplate> </viewer:BaseWidget>
Justin, Sorry I meant that I want you to attach your button click code that you are using for me to look at.
<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:viewer="com.esri.viewer.*"> <fx:Script> <![CDATA[ import com.esri.ags.geometry.MapPoint; import com.esri.ags.utils.WebMercatorUtil; import mx.controls.Alert; private function createPermalink():void { var currentCenter:MapPoint = WebMercatorUtil.webMercatorToGeographic(map.extent.center) as MapPoint; navigateToURL(new URLRequest( "index.html?center=" + myDegreeFormatter.format(currentCenter.y) + "," + myDegreeFormatter.format(currentCenter.x) + "&scale=" + Math.round(map.scale)), "_blank"); } private function getURLParameters():Object { var result:URLVariables = new URLVariables(); try { if (ExternalInterface.available) { // Use JavaScript to get the search string from the current browser location. // Use substring() to remove leading '?'. // See http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html var search:String = ExternalInterface.call("location.search.substring", 1); if (search && search.length > 0) { result.decode(search); } } } catch (error:Error) { Alert.show(error.toString()); } return result; } private function setMapLocation():void { var params:Object = getURLParameters(); if (params["ll"]) { var latlong:Array = String(params.ll).split(","); if (latlong.length == 2) { map.centerAt(WebMercatorUtil.geographicToWebMercator(new MapPoint(latlong[1], latlong[0])) as MapPoint); } } if (params["scale"]) { map.scale = params.scale; } } ]]> </fx:Script> <fx:Declarations> <mx:NumberFormatter id="myDegreeFormatter" precision="6" useThousandsSeparator="true"/> </fx:Declarations> <viewer:WidgetTemplate id="passURL" widgetTitle="Pass URL" width="200" height="100"> <s:HGroup id="groupURL"> <s:Button click="createPermalink()" fontSize="14" fontWeight="bold" label="Create a hyperlink"/> </s:HGroup> </viewer:WidgetTemplate> </viewer:BaseWidget>
Justin, Time to attach your button click code then.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.