Use ScriptReference and ScriptManagerProxy to load a script only in IE 8 or earlier?

I got ScriptManager and ScriptManagerProxy to talk to jquery using this technique . But the ScriptReference tag doesn't seem to have a way to handle this:

<!--[if lte IE 8]> <script language="javascript" type="text/javascript" src="../Scripts/excanvas.min.js"></script> <![endif]--> 

Is there a way to use ScriptManager for this, or do I need to roll on my own? (For now, I'm just using the script manager to calculate the correct number of characters .. / .. to put in front of the script address.)

+4
source share
1 answer

Unhappy client methods, such as the conditional comments used, do not mix with server-side technologies. I believe that the only way to do this with the ScriptManager is to programmatically add scripts to the page if your condition is met.

If you care more about running the script and then delivering it, you can do something like this:

 <!--[if lte IE 8]> var isLteIe8 = true; <![endif]--> 

And then, in your script, wrap it with if (typeof (isLteIe8)! == 'undefined') {...}

+1
source

Source: https://habr.com/ru/post/1383993/


All Articles