Home > Software engineering >  Urgent urgent, online etc.!!!!!!!!!! Duilib call local HTML, js calls baidu browser interface is not
Urgent urgent, online etc.!!!!!!!!!! Duilib call local HTML, js calls baidu browser interface is not

Time:09-16

Problem description:
VC use duilib call local HTML
HTML called baidu js library, called baidu browser location interface (directly using official controls)
//add a positioning navigation controls 
Var navigationControl=new BMap. NavigationControl ({
//on the top left corner position
Anchor: BMAP_ANCHOR_TOP_RIGHT,
//LARGE type
Type: BMAP_NAVIGATION_CONTROL_LARGE,
//enable display positioning
EnableGeolocation: true,
Offset: new BMap. Size (10, 70)
});
Map. AddControl (navigationControl);

HTML alone is up and running in the browser, click on the locate button, the browser will remind file:///want access to your location, allow or prohibit the button, can be normal after allowing positioning,

But if running in the VC the embedded Internet explorer, this reminder will not pop up, all have not been able to locate and find a lot of information, ie script also allows, couldn't find a solution,
Turn to the great god ~ ~ ~ ~ ~ ~ ~ ~

CodePudding user response:

Can send project to have a try?

CodePudding user response:

The tip of browser will pop up,
Do you want to consider other solutions did not through JS for positioning information such as by c + + interface can obtain positioning?
Baidu find out

CodePudding user response:


I only have this by name search positioning

<% @ Page Language="c #" AutoEventWireup="true" CodeBehind="WebForm1. Aspx. Cs" Inherits="baiduditu. WebForm1 % & gt;"



<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "/& gt;


<body>



    Detailed address & lt;/dt>


















<script SRC="http://webapi.amap.com/maps? V=1.3 & amp; Key=e352fb7102396e43776007e02c1b642c "& gt; </script>

Var map;
//initialize the map object, loading map
The map=new AMap. The map (" mapContainer, "{
<% %=initMap & gt;
ResizeEnable: true
});


Var marker=' ';
//register map for the click event for the mouse to click the latitude and longitude coordinates
Var clickEventListener=AMap. Event. AddListener (map, 'click', function (e) {
Var LNG=e.l nglat. GetLng ();
Var lat=e.l nglat. GetLat ();
The console. The log (marker)
if (! Marker) {
Marker=new AMap. Marker ({
Icon: "http://webapi.amap.com/images/3.png",
Position: new AMap. LngLat (LNG, lat)
});
Marker. SetMap (map);//on the map to add point
}
The else {
Marker. SetPosition (new AMap. LngLat (LNG, lat));
}
Document. The getElementById (" LNG "). The value=https://bbs.csdn.net/topics/lng;
Document. The getElementById (" lat "). The value=https://bbs.csdn.net/topics/lat;
//showTip. Show (' coordinates extracted successfully, false);
});

The function geocoder () {
if (! $(" # txt_address "). Val ()) {
Alert (" please fill out address ");
return;
}
Var MGeocoder;
"AMap. Geocoder" AMap. Service ([], the function () {
MGeocoder=new AMap. Geocoder ();
MGeocoder. GetLocation ($(" # txt_address "). Val (), function (the status, the result) {
If (status==='complete' & amp; & Result. The info==='OK') {
Var LNG=result. Geocodes [0]. Location. GetLng ();
Var lat=result. Geocodes [0]. Location. GetLat ();
$(" # LNG "). Val (LNG);
$(" # lat "). Val (lat);
Map. SetZoomAndCenter (20, new AMap. LngLat (LNG, lat));
The console. The info (LNG)
The console. The log (lat)
The console. The log (marker)
if (! Marker) {
The console. The log (map)
Marker=new AMap. Marker ({
Icon: "http://webapi.amap.com/images/3.png",
Position: new AMap. LngLat (LNG, lat)
});
Marker. SetMap (map);//on the map to add point
}
The else {
Marker. SetPosition (new AMap. LngLat (LNG, lat));
}
}
The else {alert (status + "" + result. The info)}
});
});
}
<% %=setMarker & gt;

$(" amap - the logo "). The attr (" style ", "display: none");

//function loca2 () {
.//var myGeo=new BMap Geocoder ();//& lt; % - create a new address translation class - % & gt;
//var dizhi=$(" # txt_address "). Val ();//& lt; % - address - % & gt;
//myGeo. GetPoint (dizhi, function (point) {//& lt; % - address translated into coordinates - % & gt;
//if (point) {
//map. CenterAndZoom (point, 15);//& lt; - % % - at the center of the map to coordinates place & gt;
//$(" # lat "). The val (point. Lat);//& lt; - controls the assignment - % % & gt;
//$(" # LNG "). The val (point. LNG);//& lt; - controls the assignment - % % & gt;
nullnullnullnullnullnullnullnull
  • Related