21540

Loading different scripts versions depending on IE version

Question:

I have an asp.net mvc 4 web application that must be compatible with IE 7 to IE 10 and then depending on the IE used I have problems with some scripts version (jquery, etc.) so under my root scripts folder I have created a new folder called OlderIE. When IE 7 is used I want the scripts in OlderIE folder to be loaded. And when IE > 7 is used, the I want scripts in Scripts root folder to be loaded. So how to do this?

Related to this, is it possible to have installed in my asp.net mvc 4 project different versions of scripts (jQuery, jQuery unobtrusive, etc.) and use them depending on IE version?

<strong>UPDATED</strong>: I want this because I am using jquery-1.9.1 and all its dependencies when using IE >= 8 but it is not working in IE 7. so when using IE 7 I use jquery-1.6.4 and its dependencies (jquery unobtrusive, etc.). So I want to know how to do this. Is it posible in the same Project to have multiple versions of jquery, jquery unobtrusive, etc. installed? If so, how to do this and how to load the correct ones depending on the IE being used?

Answer1:

Use this plugin to get version and name of browsers.

<a href="http://jquery.thewikies.com/browser/" rel="nofollow">http://jquery.thewikies.com/browser/</a>

Answer2:

You can use conditional comments. For example, if you want something to be used only by IE7 you can use the following code.

<!--[if IE 7]> According to the conditional comment this is IE 7<br /> <![endif]-->

You can also put "greater than" or "lower than" conditions, e.g. for IE versions lower than IE9.

<!--[if lt IE 9]> According to the conditional comment this is IE lower than 9<br /> <![endif]-->

Inside these comments you can put your scripts.

For more info you can read <a href="http://www.quirksmode.org/css/condcom.html" rel="nofollow">this</a>

Recommend

  • Why do I get an error installing bson_ext?
  • How do I find intersection of 3 arrays, while ignoring empty arrays?
  • What is the purpose of /usr/lib/vendor_ruby
  • Undefined symbol using charlock_holmes gem
  • undefined method `render' for class `ActionView::Base'
  • stack every n columns of a matrix without apply in R
  • Is there a difference in these javascript include definitions
  • jQueryUI sortable and draggable target won't scroll horizontally for drop but will for sort
  • Does ruby on rails have client side validation like ASP.NET MVC
  • Scripting PDF Creation
  • Stanford-parser in Ruby does not create Preprocesser
  • 500 internal server error in ruby on rails
  • scrollOverflow not working in fullPage.js
  • python: forcing relative imports to search from script file
  • Python 3.2.2, error(scripts to exe)
  • Why cepheus don't send int without quotes to orion?
  • Using JRuby with Rails 3.2
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • Test if a set exists before trying to drop it
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • RectangularRangeIndicator format like triangular using dojo
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Can I make an Android app that runs a web view in Chrome 39?
  • Updated Ionic CLI but shows previous version (Windows)
  • How to get next/previous record number?
  • Why winpcap requires both .lib and .dll to run?
  • Confusion with PayPal's monthly billing cycle
  • File upload with ng-file-upload throwing error
  • Free memory of cv::Mat loaded using FileStorage API
  • How to set the response of a form post action to a iframe source?
  • how does django model after text[] in postgresql [duplicate]
  • Java static initializers and reflection
  • Cant find why the layout is getting smaller
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • unknown Exception android
  • Append folder name and increment by 1 using batch script
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?