IE 11内部网上的Angular-以编程方式禁用兼容性视图 [英] Angular on IE 11 intranet - programmatically disable Compatibility View

查看:87
本文介绍了IE 11内部网上的Angular-以编程方式禁用兼容性视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过IE11在公司intranet上运行Angular 6应用.我的应用程序根据tscnfig.json编译为ES5.我已经取消注释并在polyfills.js中安装了所有IE兼容性行.我还在<head>标签下面添加了建议的元标签<meta http-equiv="X-UA-Compatible" content="IE=Edge" />.

I'm running an Angular 6 app on company intranet via IE11. My app compiles to ES5 according to tscnfig.json. I've uncommented and installed all of the IE compatibility lines in polyfills.js. I've also added the suggested meta tag <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> just below my <head> tag.

这些都没有通过编程方式禁用IE的默认兼容性视图设置的预期行为.默认情况下,IE11 displays intranet sites in Compatibility View会中断Angular.我唯一能找到的解决方案是让我们每个用户都进入IE的Compatibility View Settings并取消选中此框:

None of this had had the intended behavior of programmatically disabling IE's default Compatibility View settings. By default, IE11 displays intranet sites in Compatibility View, which breaks Angular. The only solution I've been able to find is having every one of our users go into their IE's Compatibility View Settings and uncheck this box:

这不是所希望的.还有什么我可以尝试的吗?在某些地方,我读到没有解决方法-在其他地方,我读到了IE=Edge meta标签是解决方案-但我发现meta标签修复是假新闻...我可以告诉你.

This is less than desirable. Is there something else I can try? In some places I've read that there's no workaround for this - and in others, I've read the IE=Edge meta tag is the solution - but I've found the meta tag fix to be fake news...that I can tell you.

推荐答案

我回过头看了看我的index.html文件.我所做的唯一更改是,我们有一个重复的元标记已被注释掉,并且Edge元标记的属性和末尾的/>之间有一些额外的间距.

I went back and looked closer at my index.html file. The only changes I made was that we had a duplicate meta tag that was commented out, and some extra spacing between our Edge meta tag's attributes and the /> at the end.

我删除了所有这些内容,现在无论设置如何,该应用程序都可以运行.我尝试删除一些空格,而不删除其他空格,或者不删除注释的代码而不是删除它-从应用程序正常工作到此时无法正常工作的更改似乎是随机的,并没有真正加起来(服务器延迟?)-所以我无法查明原因.但是我确实知道,一旦我删除了所有多余的空格并注释掉了meta,它就可以工作-尽管我认为这无关紧要.

I erased all of these and now the app works regardless of the settings. I tried to play around with deleting some spaces but not others, or not deleting the commented code vs deleting it - the change from the app working to not working at that point seemed random and didn't really add up (server lag?) - so I couldn't pinpoint the cause. But I do know that once I removed all of the excess spacing and the commented out meta, it works - despite me thinking this wouldn't matter.

确保每次测试之前我都清除了缓存等,并且让我的队友尝试了他们的机器.我希望这可以解决问题,并且没有比这更多的随机性了.如果再次中断,我将更新此线程,但现在可以正常工作.感谢所有发表评论的人.

Made sure I cleared cache, etc before testing each time, and had my team mates try on their machine. I hope this solved the issue and it's not more random than that. If it breaks again, I'll update this thread, but for now its working. Thanks to all who commented.

这篇关于IE 11内部网上的Angular-以编程方式禁用兼容性视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆