PDA

View Full Version : Miscellaneous Hacks - IE11 browser detection and fixes


Zachery
10-16-2013, 10:00 PM
IE11 gets along pretty well with vB3, though file downloads get a bit wonky due to some changes in how IE is detected.

In includes/functions.php find:


// detect macintosh

Add above:

// Detect Modern IE11+
if (strpos($useragent, 'trident') !== false AND !$is['opera'] AND !$is['ie'])
{
preg_match('#rv:([0-9\.-]+)#', $useragent, $regs);
$is['ie'] = $regs[1];

}


Next, find:

if (strpos($useragent, 'gecko') !== false AND !$is['safari'] AND !$is['konqueror'])

And replace it with

if (strpos($useragent, 'gecko') !== false AND !$is['safari'] AND !$is['konqueror'] AND !$is['ie'])

Zachery
10-17-2013, 04:35 PM
You do that then...

Max Taxable
10-17-2013, 04:36 PM
But only if it's okay with you. :D

BirdOPrey5
10-17-2013, 05:09 PM
Only the mod author is allowed 1 reserved post directly below their modification post. Reserved posts aren't permitted elsewhere on the site.

Max Taxable
10-17-2013, 07:27 PM
Only the mod author is allowed 1 reserved post directly below their modification post. Reserved posts aren't permitted elsewhere on the site.Ahh, live and learn! I always thought it was for the purpose of subscribing to a thread to make it easy to find later! Reserving installation for a later time but keeping track of progress in the thread.

NOW I understand.

Zachery
10-17-2013, 08:09 PM
TAg, or install it, if you want to keep dibs on it :)

Zachery
11-20-2013, 07:28 PM
Made a small change to fix a IE10 detection issue.

cellarius
12-02-2013, 10:12 AM
Thanks, Zachery! Installed. Do you know whether this will be included into vB3.8.8 before release? Just so I know whether I'll have to remember to redo it after an eventual upgrade.

Zachery
12-02-2013, 03:45 PM
I don't think so, I haven't asked about it. But the fix is fairly trivial at least.

BirdOPrey5
12-03-2013, 06:36 PM
A bug for IE11 detection is marked as resolved in JIRA-
http://tracker.vbulletin.com/browse/VBIII-12932

Looks like it would fix this issue.

Boothby
12-03-2013, 06:52 PM
What about the browser detection in the javascript files? Do they need a fix as well?

Zachery
12-03-2013, 08:10 PM
Nearly positive all of our detection is done with is_browser, I haven't detected anything working/not working based on js detection.

bitwise2000
12-12-2013, 12:14 AM
Anyone fixed this on 3.7?

Paul M
12-12-2013, 12:31 AM
Thanks, Zachery! Installed. Do you know whether this will be included into vB3.8.8 before release? Just so I know whether I'll have to remember to redo it after an eventual upgrade.
I added it to 3.8.8 Beta 3.

(Yes, I know it not downloadable yet, but it will be when I get time to make it available).

bitwise2000
12-15-2013, 03:07 PM
Anyone fixed this on 3.7?

Answered my own question. Fix is identical for 3.7.6

Thanks!

EvilLS1
12-17-2013, 12:32 AM
Smileys don't seem to work in IE11/vB3.8 by clicking them in WYSIWYG mode. Works fine in compatibility mode. Any fix for this?

Edit: Enabling the "Send Internet Explorer 7 Compatibility Header" option seems to fix it, however if I do that mods like the vbshop stop working properly (clicking the tabs on the main page of the shop does nothing).

Zachery
12-17-2013, 01:32 AM
It appears that YUI will also need to be updated to handle the issues with the editor. Though, I don't know how reasonable that will be. I suspect we can just append similar code to the YUI file for browser matching. But I'm not overly familiar with js.

You'd want to look at

/clientscript/yui/yahoo-dom-event.js and find:

else{A=B.match(/MSIE\s([^;]*)/);

Then you'd have to append something to match Trident, instead of IE, and check for rv: instead of the MSIE version string. I'm not a pro at regex so I don't quiet understand how that regex works or what its trying to match.

I don't think any version of YUI supports IE11 though, since it was discontinued almost 3 years ago now. Before IE was even a thing.
You'd need to add something like

else{A=B.match(/Trident\s([^;]*)/);


basically, you need to patch YUI with IE11 detection. I'm not sure if the above code is correct, you'll have to dig around and check out how the user agent is parsed, and then figure out how to add the additional parsing.

EvilLS1
12-17-2013, 01:43 AM
Thanks Zachery. I'll have a look at it tomorrow. :)

BirdOPrey5
12-17-2013, 10:03 AM
This regex will match Trident OR MSIE....

[Trident|MSIE]+\s([^;]*)
so the code would be...


else{A=B.match(/[Trident|MSIE]+\s([^;]*)/);


Note- it should work but is not a perfect Regex- besides matching Trident or MSIE it will also match for example rent or SIEM but since these aren't valid / known useragents it should be OK.

Digital Jedi
12-17-2013, 10:02 PM
<font face="Courier">(Trident|MSIE)</font> would match specifically one of those two words, but I don' know how that affects the JS.

BirdOPrey5
12-17-2013, 11:16 PM
(Trident|MSIE) would match specifically one of those two words, but I don' know how that affects the JS.

My concern was the extra parentheses would throw off the rest of the script.

Zachery
12-22-2013, 03:16 PM
Did anyone try?

JamesC70
12-28-2013, 11:36 PM
Smileys don't seem to work in IE11/vB3.8 by clicking them in WYSIWYG mode. Works fine in compatibility mode. Any fix for this?

It appears that YUI will also need to be updated to handle the issues with the editor. Though, I don't know how reasonable that will be. I suspect we can just append similar code to the YUI file for browser matching. But I'm not overly familiar with js.

YUI has been updated: http://www.yuiblog.com/blog/2013/12/18/yui-3-14-1-released/ Has anyone at vB verified that this fixes the issue on 3-series forums? (Alternately: how badly would it screw up our sites if we used this one instead of YUI 2.9.0? :rolleyes: )

Zachery
12-28-2013, 11:42 PM
YUI 3, is not YUI 2, its not a drop in replacement. Moving to YUI 3 is about the same as moving to Jquery, or another similar js lib.

So yes, to get IE11 support in vBulletin fully, you'd need to update yui to support something it wasn't originally intended to.

Boothby
01-05-2014, 03:10 PM
[Trident|MSIE]+

Sorry, but this makes no sense at all, because it would even match M or MM or MMMMMMMM or in an unbelievable worst case |||||. Uuuh. ;)
The | has no meaning between []. The chars/letters are alternatives, so you could also write:
(T|r|i|d|e|n|t|\||M|S|I|E){1,}

So, after looking into the original source codes of YUI 2 and 3 I would suggest to replace

else{a=c.match(/MSIE\s([^;]*)/);if(a&&a[1]){g.ie=e(a[1]);}

with

else{a=c.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/);if(a&&(a[1]||a[2])){g.ie=e(a[1]||a[2]);}

The browser detection is very similar in both, YUI 2 and 3 and the above code is from YUI3 and then backminified by me. :eek:

untested, hope it works ;)

cellarius
01-05-2014, 06:57 PM
What YUI version file do you use, Boothby? I don't have that line in my /clientscript/yui/yahoo-dom-event.js.

Boothby
01-05-2014, 07:26 PM
I downloaded the latest version from yahoo, 2.9.0, and it seems identical to the latest stable and beta vBulletin builds. In an older build on my local install I found also Zachery's code (https://vborg.vbsupport.ru/showpost.php?p=2468869&postcount=17) which was from 2.7.0.

Here it is:

Find:
else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}
and replace with:
else{A=B.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/);if(A&&(A[1]||A[2])){C.ie=parseFloat(A[1]||A[2]);}

And again, not tested with best hopes. :D

Zachery
01-05-2014, 08:20 PM
digitalpoint did some testing and he said the YUI 2.9 seemed to work, but again, its not supported by default.

cellarius
01-05-2014, 08:45 PM
Thanks guys, appreciated! Shawn's word is good enough for me :-)

Boothby
01-06-2014, 04:29 AM
YUI 2.9 is in the current download packages of vB 3.8.7 and 3.8.8.

/*
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.9.0
*/

cellarius
01-06-2014, 09:29 AM
Up to now, l was using offsite, So never really cared :)

wacnstac
01-08-2014, 05:29 PM
I'm confused as my latest stock install of 3.8.7 pulls YUI 2.9 directly from yahoo. Are you guys pulling the 2.9, modding it and then pointing your board to your own modded version?

cellarius
01-08-2014, 05:35 PM
I plan on downloading the latest vB3.8 version, get the yui files provided in the package, modify them and use those on my server.

wacnstac
01-09-2014, 03:07 PM
I plan on downloading the latest vB3.8 version, get the yui files provided in the package, modify them and use those on my server.

I tried this process with the suggested modification and loaded the .js file from my own server but it didn't seem to fix the problem. Can anyone else confirm?

realdx
02-03-2014, 10:26 AM
I have vB3.8.4 version and 2,7 YUI version. I tryed to apply mod to *.js file but smiles not works in IE11 :-(((((((

realdx
02-06-2014, 07:01 AM
These are my problems with IE11:

- If I put this correct code into headinclude, smiles not works and lightbox for attachment files works very very well

<meta http-equiv="X-UA-Compatible" content="IE=11" />

- If I remove code from headinclude, smiles works fine but lightbox for attachment files works bad: it opens but not load image...if click into black box, image opens in a new window's browser...late if click another time on thumbnail, image opens fine with lightbox (because image is present into cache????)

PLEASE HELP ME !!!

Zachery
02-06-2014, 07:44 AM
Try IE=10

realdx
02-06-2014, 09:45 AM
I've already tried this mod. Nothing !

Probably with IE10 installed works fine, but I wanted to try to fix problems in IE11, for next years...

I hope to receive help and solutions from some coder or developers :-)

Zachery
02-06-2014, 07:35 PM
<meta http-equiv="X-UA-Compatible" content="IE=10" /> That is what I meant/

realdx
02-06-2014, 07:44 PM
Thank you Zachery, I understood your suggestion. I've already tried that code but without change :-(