Http sites does not detect the location in Chrome - issue(Http 站点未检测到 Chrome 中的位置 - 问题)
问题描述
我们今天确实注意到了根据用户位置自动检测邮政编码的问题.它在其他浏览器(edge、IE、Firefox)中运行良好我们必须将站点配置为 https,然后它就可以正常工作了
We did notice today an issue in automatic detection of zip code based on the user s location. it worked well in other browsers(edge, IE, Firefox) We had to configure the sites to https and then it works ok
示例:https://www.whatismyzip.com/ 效果很好其中 http://www.mapdevelopers.com/what-is-my-zip-code.php 不起作用.
Example : https://www.whatismyzip.com/ works well where as http://www.mapdevelopers.com/what-is-my-zip-code.php does'nt work.
<script type="text/javascript" src="aHR0cHM6Ly9tYXBzLmdvb2dsZWFwaXMuY29tL21hcHMvYXBpL2pzP2tleT1BSXphU3lBZEdRS0k0c0VqNVRaQWpOQ2RzNDIyVl9aSGV2RDQ1Rm8="></script>
<%-- <script type="text/javascript" src="aHR0cHM6Ly9tYXBzLmdvb2dsZWFwaXMuY29tL21hcHMvYXBpL2pzP3NlbnNvcj1mYWxzZSZhbXA7bGlicmFyaWVzPXBsYWNlcw=="></script>--%>
<%-- <script type="text/javascript" src="aHR0cHM6Ly9tYXBzLmdvb2dsZWFwaXMuY29tL21hcHMvYXBpL2pzP2xpYnJhcmllcz1wbGFjZXM="></script>
<script type="text/javascript" src="aHR0cHM6Ly9hamF4Lmdvb2dsZWFwaXMuY29tL2FqYXgvbGlicy9qcXVlcnkvMS44LjMvanF1ZXJ5Lm1pbi5qcw=="></script>--%>
<script type="text/javascript">
function ShowMessages() {
debugger;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success);
} else {
alert("Geo Location is not supported on your current browser!");
}
function success(position) {
debugger;
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var latlng = new google.maps.LatLng(lat, lng);
var geocoder = geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
var searchAddressComponents = results[0].address_components,
searchPostalCode = "";
$.each(searchAddressComponents, function () {
if (this.types[0] == "postal_code") {
searchPostalCode = this.short_name;
}
});
document.getElementById('hidden1').value = searchPostalCode
__doPostBack('', '');
}
}
});
}
}
任何帮助/解决方法将不胜感激.
Any help/workaround would be appreciated.
除了 Google API,还有其他可行的替代方案吗?
推荐答案
Chrome 50
中引入的新安全规则不会将位置信息发送到没有 Transfer Encryption
的站点.
The new Security rule introduced in Chrome 50
does not send Location Information to Sites without Transfer Encryption
.
这里是适合 Mapping API 问题的替代方案.
Here are the alternatives which are apt for the Mapping API problems.
恢复到之前的 Chrome(50) 版本也是一种解决方案,但是在 Web 开发中,这样做是相当困难的.
Reverting to Prior versions of the Chrome(50) is also a solution, but in Web development, it is quite difficult to do so.
但事实是,目前只有 Chrome 与 Mapping API
存在此类问题,其他 浏览器 仍然支持它们(其中让我暂时放心)
.
But the fact is that, currently only Chrome has such issues with Mapping API
and other Browsers still supports them(Which gives me a short term peace of mind)
.
但迟早,这可能会被其他浏览器实践,这对于与我不同的现有用户来说可能是一个大问题.由于这是一个长期的过程(在我的情况下),最好开始开发和迁移到 https 站点而不是在 http 中,但是有 利弊处理它们.
But sooner or later, this may be practiced by other browsers too, which may be a big problem for the existing users unlike me. Since it is a long term process(in my case), it is better to start developing and migrating to https sites rather than being in http, how ever there are pros and cons in handling them.
这篇关于Http 站点未检测到 Chrome 中的位置 - 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Http 站点未检测到 Chrome 中的位置 - 问题


- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 400或500级别的HTTP响应 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06