Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude IE6 and Below in code #14

Closed
djamell opened this issue Aug 25, 2010 · 6 comments
Closed

Exclude IE6 and Below in code #14

djamell opened this issue Aug 25, 2010 · 6 comments

Comments

@djamell
Copy link

djamell commented Aug 25, 2010

I think this has been raised before so forgive me. I was looking for a way to prevent the script from running if the browser version was IE6 or older. Googling around I found references to javascript techniques that could do this, but I really don't want to hack on the code myself.

Is there a possibility that a browser or "feature" test could be inserted to stop the code from executing if the browser is IE6 or older?

Thanks in advance.

@srobbin
Copy link
Member

srobbin commented Sep 16, 2010

Hi djamell,

I'll look into it for the next release. In the meantime, I'd recommend that you use jQuery to detect whether or not to use backstretch. Something like this:

if (!$.browser.msie && !$.browser.version=="6.0") {
 $.backstretch(...)
}

@bradyjfrey
Copy link

Instead of that, might as well just use an IE 6 stylesheet:

And then serve up that div ala #backstretch with some IE 6 specifics, such as {display: none;}

@djamell
Copy link
Author

djamell commented Dec 5, 2010

I tried both techniques without success. But I'm not sure if I did it the correct way. Here is what I have now:

HTML (Had to replace "<>" with "{}" to get it to display in this comment

{--[if lte IE 6]}
{link rel="stylesheet" type="text/css" href="ie6.css" /}
{![endif]--}

{div id="hideie6"}
{script type="text/javascript" src="/resources/shared/scripts/jquery/jquery.min.js"}{/script}
{script type="text/javascript" src="jquery.backstretch.js"}{/script}
{script type="text/javascript"}
if (!$.browser.msie && !$.browser.version=="6.0") {
$.backstretch("/images/bg.jpg", {speed: 1000})
}{/script}
{/div}

CSS (ie6.css)

/------ CSS Document for IE6 and Below -----/

#hideie6 {display: none;}

Please tell me what I'm doing wrong.

@bradyjfrey
Copy link

You've got your conditional comments right, in the file ie6.css put:
#backstretch {display: none;}

Backstretch creates a div it puts on the page with that ID, so target that and it'll go away:). Doing that will remove your need for any other javascript that targets IE, the CSS will do it for you.

Here's an example of a site I did a few weeks back:
http://belvedereplace.com/

It uses conditional comments for the CSS, like you, and links to:
http://belvedereplace.com/style_ie6.css

Which I've hidden the backstretch div on the first line.

@djamell
Copy link
Author

djamell commented Dec 5, 2010

Ohhhhhh! I get it. Works like a champ. Thank you so much!

@bradyjfrey
Copy link

You're welcome!

danielgindi added a commit that referenced this issue Mar 5, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants