Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Don't load jquery 2.x for IE 8 #178

Closed
AdamChlan opened this issue Dec 29, 2014 · 9 comments
Closed

Don't load jquery 2.x for IE 8 #178

AdamChlan opened this issue Dec 29, 2014 · 9 comments

Comments

@AdamChlan
Copy link
Contributor

I'm using conditional code in my header.php file to load jquery 1.x and a few other files for IE 8. This works very well for making the foundation play nicely in IE 8. I'd also like to NOT load jquery 2.0 if on IE 8, which is loaded in enqueue-scripts.php. Has anyone hidden this file conditionally for IE 8, or have any advice on the best way to do it?

@AdamChlan
Copy link
Contributor Author

Here is how I handled this. If anyone has any other suggestions, please let me know:

// Enqueue scripts
if(preg_match('/(?i)msie [8]/',$_SERVER['HTTP_USER_AGENT']))
{
    require_once('library/enqueue-scripts-ie8.php');
}
else
{
    require_once('library/enqueue-scripts.php');
}

@olefredrik
Copy link
Owner

<funfact> 99.86% of visitors to the FoundationPress demo site during the period 01.January 2014 - 30 December 2014 used a newer browser than IE8. Out of 60,154 sessions (divided into 191,345 page views), there were 82 users of IE8, 6 users of IE7 and 1 poor user of IE6. :) </funfact>

<fact>I think it makes more sense to spend time on creating the best possible service for 99.86% of the user base, rather than wasting time on the little 0.14% portion of users.</fact>

Disclaimer: The visitors of the FoundationPress demo site is probably more tech-savvy (and awesome) than average and are hence not representative of the common user . But in all cases , the use of IE8 dropped drastically in recent years.

@AdamChlan
Copy link
Contributor Author

Couldn't agree with you more, Ole. But sometimes you get those clients that don't even want a JS error to show up in IE8, so I had to come up with something.

@olefredrik
Copy link
Owner

I know the feeling ;) Happy new year!

@versedi
Copy link

versedi commented Jan 14, 2015

I'm with you 10000% with IE death wish. But sometimes you just have to achieve something because of whatever reason possible.

I'm personally using below code as starter of HTML document

<!DOCTYPE html>
<!--[if IE 7]>
<html class="no-js ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="no-js ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 9]>
<html class="no-js lt-ie10" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8)  ]><!-->

and before the body closing tag:

<!--[if lt IE 9]>
  <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
  <script src="//s3.amazonaws.com/nwapi/nwmatcher/nwmatcher-1.2.5-min.js"></script>
  <script src="//html5base.googlecode.com/svn-history/r38/trunk/js/selectivizr-1.0.3b.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.1.0/respond.min.js"></script>
    <script src="js/rem.js" type="text/javascript"></script>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>  
<![endif]-->

The last thing I'm trying to get working are buttons, I'm not sure why they're rendered by IE8 totally weird. Offcanvas workaround: iehack.css with .off-canvas-left { display:none; }

Ofcourse if you're using any plugins you'll also have to get rid of their loading.

@themestechnology
Copy link
Contributor

From my understanding foundation uses rem size measurement that is not
supported in IE7 and IE8 so would there be any point using that code?

http://caniuse.com/#search=rem

Also $_SERVER['HTTP_USER_AGENT'] could be used to detect detect the device
browser rather than it appearing in Firefox and Chrome

Best Regards

Phill Booth. Theme Tec

Please remember add my email to your address book.

web: http://www.themes.technology

email: help@themes.technology help@fthemes.technology

portfolio: http://themeforest.net/user/phillbooth/portfolio?ref=phillbooth

time zone: GMT+0 London, United Kingdom

On 14 January 2015 at 19:14, Tadeusz S notifications@github.com wrote:

I'm personally using


Reply to this email directly or view it on GitHub
#178 (comment)
.

@versedi
Copy link

versedi commented Jan 17, 2015

@Aetles
Copy link
Contributor

Aetles commented Jan 17, 2015

FWIW last year when I was trying different REM polyfills to make Foundation 5 layouts work in IE 8 I ended up using grunt-pixrem instead as it work much better for me.

@andreaarcher
Copy link

I'm trying some conditional logic in my enqueue-scripts.php to get a certain js to not load in ie11 only,
I'm using

if(preg_match('/(?i)msie [11]/',$_SERVER['HTTP_USER_AGENT']))
    {

         wp_enqueue_script( 'foundation', get_template_directory_uri() . '/assets/javascript/foundation.js', array('jquery'), '2.3.0', true );

    }
    else 
    {
         wp_enqueue_script( 'foundation', get_template_directory_uri() . '/assets/javascript/foundation.js', array('jquery'), '2.3.0', true );

        wp_enqueue_script( 'wow', get_template_directory_uri() . '/assets/javascript/wow.js', array('jquery'), null);
    }

but it's not working -- both files are still loading on ie11. Any ideas?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants