Jump to content

hide link to JavaScript in IE7 only


webguync

Recommended Posts

Is there a way to just hide an external link to a JS file specifically in IE7? I have some JQuery slide in effects working fine in every browser I tested in except IE7.(the functiality is completely screwy in that browser) It's not a necessary functionality to the page, so instead of racking my brain trying to fix in IE7, I was just hoping to hide/disable the link (IE7 only). That way nothing will happen in IE7 which is what I want.

Link to comment
Share on other sites

You could use IE conditionals to only include the script for IE8+, but I would build the logic into the JS, not the HTML. Using jQuery you have access to $.browser which makes it easy. In the document ready function or however your code is initialised, just add a return statement when the browser is IE7 (or less I'm guessing too?)

$(function() {

if ($.browser.msie && parseInt($.browser.version) <= 7) {
return;
}

bindAllTheThings();
});
Link to comment
Share on other sites

Alternatively if you were to only bindAllTheThings() when the browser is NOT IE7 or less, you could still bind certain functionality and not others:

$(function() {

var isIe7 = ($.browser.msie && parseInt($.browser.version) <= 7)
? true : false;

if (!isIe7) {
bindSomeThings();
}

bindRestOfThings();
});
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.