从IE发送的所有ajax调用都由Angular缓存,我得到一个304 response用于所有后续调用.虽然请求是相同的,但在我的情况下,回复并不相同.我想禁用此缓存.我尝试添加cache attribute到$ http.get但仍然没有帮助.如何解决这个问题?
当我想检测IE时,我使用此代码:
function getInternetExplorerVersion()
{
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
function checkVersion()
{
var msg = "You're not using Internet Explorer.";
var ver = getInternetExplorerVersion();
if ( ver > -1 )
{
msg = "You are using IE " + ver;
}
alert( msg );
}
Run Code Online (Sandbox Code Playgroud)
但IE11正在返回"你没有使用Internet Explorer".我该如何检测它?
debugging internet-explorer browser-detection forward-compatibility internet-explorer-11
我有一个问题,我想只在浏览器不是Internet Explorer的情况下才向项目添加css类.
我可以用Angular JS做到吗?
就像是:
<div ng-class="myClass : "BROWSER IS IE" ? default"><div>
Run Code Online (Sandbox Code Playgroud)
解:
HTML:
<div data-ng-class="getClass()"></div>
JAVASCRIPT:
$scope.isIe = function () {
return false || !!document.documentMode;
}
$scope.getClass = function () {
if ($scope.isIe()) {
return "";
}
else {
return "yourClass1 yourClass2 yourClass3";
}
}
Run Code Online (Sandbox Code Playgroud)