Is it possible to use
var script = document.createElement('link');
script.href = 'theme/style/ie/manageleads.css';
script.rel = 'stylesheet';
script.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(script);
and for it to only be active if the browser is IE8?
Is it possible to use
var script = document.createElement('link');
script.href = 'theme/style/ie/manageleads.css';
script.rel = 'stylesheet';
script.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(script);
and for it to only be active if the browser is IE8?
Share Improve this question edited Nov 5, 2014 at 11:22 Joe 15.8k4 gold badges50 silver badges83 bronze badges asked Sep 12, 2011 at 2:37 RussellHarrowerRussellHarrower 6,85025 gold badges113 silver badges225 bronze badges2 Answers
Reset to default 7http://api.jquery./jQuery.browser/
Note that IE8 claims to be 7 in Compatibility View.
if ($.browser == 'msie' && (parseInt($.browser.version) == 8 || parseInt($.browser.version) == 7))
{
// Do something IE8-only in here
}
The best way would be conditional CSS, but since you asked for jQuery, here ya go.
if ($.browser.msie && parseInt($.browser.version) == 8) {
$('<link />', {
href: 'theme/style/ie/manageleads.css',
rel: 'stylesheet',
type: 'text/css'
}).appendTo('head');
}
If that doesn't work, let me know. You might need to use 'document.createStylesheet' instead.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745361016a4624358.html
评论列表(0条)