网页正在减慢您的浏览器,它正在等待 csi.gstatic.com
A web page is slowing down your browser, it is waiting for csi.gstatic.com
我已经在 .net 2017 c# 上编写了 Web 应用程序,我不得不将我的 URL 更改为更简单以摆脱 ?或 = 来自 URL 并且我还在我的网站上使用 Google 地图。当我单击将被重定向并更改为其他 link 的记录时,出现此错误。
原url是:mydomain.com/Doctor?id=XX
我将其转换为:mydomain.com/Doctor/XX
我通过在 RegisterRoutes 上定义新的 MapRoute 来做到这一点:
RouteCofig.cs:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Blog", // Route name
"Doctor/{id}", // URL with parameters
new { controller = "Home", action = "PersianDR", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
我也用过angularjs:
Angular 模块:
var app = angular.module('MyApp', ['ngRoute', 'uiGmapgoogle-maps', 'nemLogging', 'ngSanitize']);
app.config(['$routeProvider', '$locationProvider', function ($routeprovider, $locationProvider) {
$routeprovider.
when('/Home/PersianDR/:id', {
templateurl: '/Views/Home/PersianDR.cshtml',
controller: 'AngularCtrl_ShowDr'
})
.
when('Doctor/:id', {
redirectto: '/Home/PersianDR/:id'
})
.
otherwise({
redirectto: '/'
})
;
//$locationProvider.html5Mode(true);
$locationProvider.html5Mode({
enabled: true,
rewriteLinks: false
});
}]);
Angular 控制器:
app.controller("AngularCtrl_ShowDr", function ($scope, $location, angularService_ShowDr, $route, $routeParams, $http, $sce) {
var docId = $("#myId").val();
$location.path();
$location.url('Doctor/' + docId).replace();
GetDoctorByID();
GetGeoCoordinates();
maps();
});
自从我更改 URL 后就出现了这个问题。
我终于找到了一个有趣的答案。
当我在使用 google 地图 api 时想要重定向并使我的 url 简单时发生冲突,这是因为 gmap 需要绝对路径或 url 而我想更改我的 url简洁大方
为了消除等待加载 csi.gstatic.com,我所做的就是使用局部视图。
我完全把我的 ui-gmap-google-map 带到了局部视图中,并从原始视图中调用了它。
原文page.cshtml:
@Html.Partial("_MapDoctor")
在局部视图中,_MapDoctor.cshtml:
<div ng-controller="AngularCtrl_MapDr">
<input type="hidden" id="myId2" value="@ViewBag.id" />
<ui-gmap-google-map center='mapsdrsec.center' zoom='mapsdrsec.zoom' options='mapsdrsec.options'>
<ui-gmap-layer type="TrafficLayer" show="mapsdrsec.showTraficLayer"></ui-gmap-layer>
<ui-gmap-markers models="markers" idkey="markers.id" coords="'coords'">
</ui-gmap-markers>
</ui-gmap-google-map>
</div>
我在 angularjs 中编写了指定的控制器和服务以供部分查看。我删除了原始填充 $scope.map 并在部分视图控制器中写入 (center, zoom, options, $scope.markers ).
我已经在 .net 2017 c# 上编写了 Web 应用程序,我不得不将我的 URL 更改为更简单以摆脱 ?或 = 来自 URL 并且我还在我的网站上使用 Google 地图。当我单击将被重定向并更改为其他 link 的记录时,出现此错误。
原url是:mydomain.com/Doctor?id=XX
我将其转换为:mydomain.com/Doctor/XX
我通过在 RegisterRoutes 上定义新的 MapRoute 来做到这一点: RouteCofig.cs:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Blog", // Route name
"Doctor/{id}", // URL with parameters
new { controller = "Home", action = "PersianDR", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
我也用过angularjs: Angular 模块:
var app = angular.module('MyApp', ['ngRoute', 'uiGmapgoogle-maps', 'nemLogging', 'ngSanitize']);
app.config(['$routeProvider', '$locationProvider', function ($routeprovider, $locationProvider) {
$routeprovider.
when('/Home/PersianDR/:id', {
templateurl: '/Views/Home/PersianDR.cshtml',
controller: 'AngularCtrl_ShowDr'
})
.
when('Doctor/:id', {
redirectto: '/Home/PersianDR/:id'
})
.
otherwise({
redirectto: '/'
})
;
//$locationProvider.html5Mode(true);
$locationProvider.html5Mode({
enabled: true,
rewriteLinks: false
});
}]);
Angular 控制器:
app.controller("AngularCtrl_ShowDr", function ($scope, $location, angularService_ShowDr, $route, $routeParams, $http, $sce) {
var docId = $("#myId").val();
$location.path();
$location.url('Doctor/' + docId).replace();
GetDoctorByID();
GetGeoCoordinates();
maps();
});
自从我更改 URL 后就出现了这个问题。
我终于找到了一个有趣的答案。 当我在使用 google 地图 api 时想要重定向并使我的 url 简单时发生冲突,这是因为 gmap 需要绝对路径或 url 而我想更改我的 url简洁大方
为了消除等待加载 csi.gstatic.com,我所做的就是使用局部视图。
我完全把我的 ui-gmap-google-map 带到了局部视图中,并从原始视图中调用了它。
原文page.cshtml:
@Html.Partial("_MapDoctor")
在局部视图中,_MapDoctor.cshtml:
<div ng-controller="AngularCtrl_MapDr">
<input type="hidden" id="myId2" value="@ViewBag.id" />
<ui-gmap-google-map center='mapsdrsec.center' zoom='mapsdrsec.zoom' options='mapsdrsec.options'>
<ui-gmap-layer type="TrafficLayer" show="mapsdrsec.showTraficLayer"></ui-gmap-layer>
<ui-gmap-markers models="markers" idkey="markers.id" coords="'coords'">
</ui-gmap-markers>
</ui-gmap-google-map>
</div>
我在 angularjs 中编写了指定的控制器和服务以供部分查看。我删除了原始填充 $scope.map 并在部分视图控制器中写入 (center, zoom, options, $scope.markers ).