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
https://forums.phpfreaks.com/topic/275338-hide-link-to-javascript-in-ie7-only/
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();
});

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();
});

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.