Ie ignore javascript files or code in general
In css when you want something to be ie only you can comment it out and assign ie. I have a jquery plugin that breaks in IE I don't want it to run in ie but I want it to run in all other browsers. How can I do this?
this worked!
jQuery(function() {
if(jQuery.browser.msie){}
else
{$('.div').corn开发者_JS百科er("round 20px");};
});
Try using conditional comments.
http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
http://www.quirksmode.org/css/condcom.html
<!--[if !IE]>
Special instructions for non IE browsers
<![endif]-->
Add some form of browser checking code that wraps your code in an if statement and only selectively runs it.
Psuedo code:
if( browse != "IE" )
{
... run code that breaks in IE ...
}
Or you could possibly wrap it in side of a try
/catch
block
You can use jQuery.browser to check the browser and version. However, it is discouraged by the manual because it's bad practice to check only the browser name. It's much better to track down what feature in the browser is breaking the plugin and then check for that feature only with jQuery.support or similar.
精彩评论