美文网首页
angular 1.2版本兼容ie8

angular 1.2版本兼容ie8

作者: 清汤饺子 | 来源:发表于2018-09-12 10:41 被阅读0次

1、html的title中加入如下meta:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

2、引入js:

 <!--[if IE 8]>
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/4.0.5/es5-shim.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
</style>
<![endif]-->

这个ie8的兼容版解决了很多AngularJS在IE8中的兼容问题,但是在IE8下的兼容依然会存在一些问题,比如文字图标在IE8中使用的时候会存在需要反流才能显示的情况,很多基于AngularJS的组件在IE8下的异常等等。

3、自定义指令

4、html加入id="ng-app"

<html lang="zh-CN" xmlns:ng="http://angularjs.org" id="ng-app" ng-app="AuthenticationApp">

5.placeholder的问题

6.如果还是不行。看下ie的控制台报什么错,再去对照修改,比如只能var 定义变量,不支持string.split()方法等。如果有引用都会报错


image
placeholder.js

$(function(){
//判断浏览器是否支持placeholder属性
supportPlaceholder='placeholder'in document.createElement('input');

placeholder=function(input){

    var text = input.attr('placeholder');
    defaultValue = input.defaultValue;

    if(!defaultValue){

        input.val(text).addClass("phcolor");
    }

    input.focus(function(){

        if(input.val() == text){

            $(this).val("");
        }
    })


    input.blur(function(){

        if(input.val() == ""){

            $(this).val(text).addClass("phcolor");
        }
    });

    //输入的字符不为灰色
    input.keydown(function(){

        $(this).removeClass("phcolor");
    })
}

//当浏览器不支持placeholder属性时,调用placeholder函数
if(!supportPlaceholder){

    $('input').each(function(){

        text = $(this).attr("placeholder");

        if($(this).attr("type") == "text"){

            placeholder($(this));
        }
    })
}
});

相关文章

  • angular 1.2版本兼容ie8

    1、html的title中加入如下meta: 2、引入js: 这个ie8的兼容版解决了很多AngularJS在IE...

  • DOM 库

    jQuery中文文档 jQuery版本 1.x (兼容到IE6) 2.x (不兼容IE8以上,包括IE8) 3.x...

  • angular PC 端框架搭建

    angular 6 兼容性 了解angular不同版本支持浏览器情况,尤其是IE:https://angular....

  • getByClass兼容className

    由于document.getElementsByClassName('class名');在IE8及以下版本不兼容所...

  • swiper兼容IE

    我用的是2.X的版本,因为兼容ie8。swiper3是专门针对移动端写的。如果想兼容IE8的话,应该引入swipe...

  • vue 项目在ie浏览器的兼容问题

    注意:vue 只兼容ie8以上版本;IE 不兼容 axios的promiss对象;IE 不兼容es6语法;ES6转...

  • VUE复习笔记1(开始)

    兼容性 Vue 不支持 IE8 及以下版本,因为 Vue 使用了 IE8 无法模拟的 ECMAScript 5 特...

  • 1-Vue基础知识

    兼容性 Vue不支持IE8 及以下版本,因为 Vue 使用了 IE8 无法模拟的 ECMAScript 5 特性。...

  • Angular4.0.0强势发布,全向后兼容

    Angular4.0.0强势发布,全向后兼容 经历了6个RC版本之后,今天Angular发布了4.0.0版本,这次...

  • 北京棋院PC项目总结

    该项目要求兼容方面:火狐,谷歌,opera等主流浏览器之外,需要兼容iE8以及以上的iE版本 屏幕需要兼容小屏幕,...

网友评论

      本文标题:angular 1.2版本兼容ie8

      本文链接:https://www.haomeiwen.com/subject/oramgftx.html