问题
I have a DIV on my site that calls a few external javascripts... unfortunatley the vendor does not support IE6. This script is in the global footer, so its on every page.
I get the error that our https site is passing content that is not secure, would you like to view the content...blah blah...
Is is possible to just hide this div if the browser is IE6??
<div id="get-satisfaction">
<style>
a#fdbk_tab {
top:60px;
}
</style>
<script type="text/javascript" charset="utf-8">
//content here
</script>
</div>
回答1:
<!--[if IE 6]>
<style>#DIVID {display: none;}</style>
<![endif]-->
A better option is to detect the browser server side and not render the javascript tag if it's IE6.
回答2:
This should do the trick:
http://davidwalsh.name/ie-conditional-comments
回答3:
Add the following code before the opening DIV tag:
<!--[if !IE 6]>
Add the following code after the closing DIV tag:
<![endif]-->
so,if the browser is IE6 ,it should hide your div.
回答4:
This snippet shows the content to every browser that is newer than IE6. It's confirmed to work.
<!--[if lte IE 6]><![if gte IE 7]><![endif]-->
<!-- code here -->
<!--[if lte IE 6]><![endif]><![endif]-->
See: Hiding some HTML from IE6?
回答5:
<!--[if gt IE 6]><!-->
This code displays on non-IE browsers and on IE 7 or higher.
Include your "vendor script" here.
<!--<![endif]-->
Taken from here: http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
来源:https://stackoverflow.com/questions/6782800/hide-a-specific-div-if-browser-is-ie6