Kris-B / nanoGALLERY

image gallery simplified - jQuery plugin. Touch enabled, responsive, justified/cascading/grid layout and it supports pulling in Flickr, Google Photos and self hosted images.
https://nanogallery2.nanostudio.org/
439 stars 101 forks source link

Possible iPhone issue - version detection error #119

Closed seankenny closed 8 years ago

seankenny commented 8 years ago

Hi Kris,

I'm seeing an issue with iPhone 6s. Debugging points to an exception in the ios version detection code.

The navigator.appVersion for my device is

5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Safari/601.1.42

The iosversion detection code for iP(hone|od|ad) does not expect the OS X 10_11 and so this code throws with a null ref on the return statement.

jquery.nanogallery.js v5.10.1 line 741

G.IOSversion = (function() {
    if (/iP(hone|od|ad)/.test(navigator.platform)) {
        var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); // no match found for OS X 10_11
        return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];  // throws
    }
})();

Checking the rest of the code, it doesn't look like the G.IOSversion is used anymore (commented out) so perhaps just removing it would fix the issue. When I do this locally, we are back in business.

Thanks for a great library.

Rgds, Sean

Kris-B commented 8 years ago

Hi Sean, Many thanks for this! As you suggested, I'll remove this function.

Kris

Kris-B commented 8 years ago

just released v5.10.2: https://github.com/Kris-B/nanoGALLERY/releases/tag/v5.10.2

Thanks for your contribution