问题
I'm working on an Angular project that will be included in a HTML page I don't have control on.
Actually I only have access to what is inside the <body>
element.
There are many constraints which are not the easiest to deal with: 1- I can't change the doctype: 2- I can't remove this meta tag: 3- The app has to load an XML file
I managed to overcome points 1 and 3 but point 2 gives me a headache ! Here is the error I get when I test on IE8+ (it works fine on IE7 and other browsers):
[$sce:iequirks] http://errors.angularjs.org/1.2.12/$sce/iequirks IE8 in quirks mode is unsupported error in component $sce Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks mode. You can fix this by adding the text to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.
I found many solutions on forums but no one has worked so far... Especially hoped that disabling $sceProvider (code below) would make the app work on IE8+ but it didn't:
angular.module('ie7support', []).config(function($sceProvider) {
// Completely disable SCE to support IE7.
$sceProvider.enabled(false);`
});
I even tried to add <!doctype html>
to the top of my HTML document, which I am not allowed to but which I did just for the test, and it doesn't solve the problem.
Any help or suggestions greatly appreciated cause I'm really stuck right now...
Thanks
回答1:
Got it !!
I simply needed to give the name of my app instead of silly "ie7support" in the code below:
angular.module('ie7support', []).config(function($sceProvider) {
// Completely disable SCE to support IE7.
$sceProvider.enabled(false);
});
Found thanks to a deeper look at this article: http://docs.angularjs.org/api/ng.$sce
Hope it can help some of you !
回答2:
IE in quirks mode is not supported by AngularJS
回答3:
Thanks for your answer Adam but according to these messages, disabling $sce completely helps AngularJS to support IE in quirks mode...
https://github.com/angular/angular.js/issues/3633
[$sce:iequirks] Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks mode
来源:https://stackoverflow.com/questions/21740857/angularjs-and-quirks-mode-blank-screen-on-ie8