cocos2d / cocos2d-html5

Cocos2d for Web Browsers. Built using JavaScript.
https://www.cocos.com
3.07k stars 902 forks source link

IE11 WebGL samples/tests doesn't display menu text #992

Open Arlorean opened 11 years ago

Arlorean commented 11 years ago

I realize this is probably more a problem with IE11 but I thought I'd log the results of running the samples/tests. The console in IE11 (Windows 8.1 Preview) shows a few errors that it would be good to workaround or at least investigate:

IE11 Cocos2D WebGL Tests

HTML1300: Navigation occurred.
File: tests
Cocos2d-html5-v2.1.4
cocos2d: GL_VENDOR:     Microsoft
cocos2d: GL_RENDERER:   Internet Explorer
cocos2d: GL_VERSION:    WebGL 0.9
cocos2d: GL_EXTENSIONS:  
cocos2d: GL_MAX_TEXTURE_SIZE: 16384
cocos2d: GL_MAX_TEXTURE_UNITS: 16
cocos2d: GL supports PVRTC: NO
cocos2d: GL supports BGRA8888 textures: NO
cocos2d: GL supports NPOT textures: YES
cocos2d: GL supports discard_framebuffer: NO
cocos2d: GL supports shareable VAO: NO
WEBGL11095: INVALID_OPERATION: bindAttribLocation: Method not currently supported
...
WEBGL11002: INVALID_ENUM: pixelStorei
...
function requestAnimationFrame() { [native code] }
...
WEBGL11004: INVALID_OPERATION: vertexAttribPointer
WEBGL11094: INVALID_OPERATION: vertexAttribPointer: Enum UNSIGNED_BYTE is not currently supported
WEBGL11004: Too many errors encountered - no more errors will be logged
Arlorean commented 11 years ago

I just noticed using the latest source fails to detect IE11 from its user agent string:

Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MDDCJS; rv:11.0) like Gecko

This makes it fail in miniframework.js on this line:

cc.Browser.type = (function () {
    var browserTypes = cc.Browser.ua.match(/micromessenger|qqbrowser|mqqbrowser|ucbrowser|360browser|baidubrowser|maxthon|ie|opera|firefox/) || cc.Browser.ua.match(/chrome|safari/);
    if (browserTypes.length > 0) { // browserTypes returns null here <-----

Update: I've committed a fix locally that looks for Gecko in the ua string as suggested here but I don't have permission to add it to the core project: http://www.nczonline.net/blog/2013/03/27/internet-explorer-11s-user-agent-string-what-does-it-mean/