Skip to content

Commit f0511de

Browse files
author
pandamicro
committed
Deactivate webgl in iOS UIWebView to avoid crash
1 parent d604622 commit f0511de

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CCBoot.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1859,10 +1859,17 @@ var _initSys = function () {
18591859
var tmpCanvas = document.createElement("CANVAS");
18601860
try{
18611861
var context = cc.create3DContext(tmpCanvas, {'stencil': true});
1862-
if(context) {
1862+
if (context && context.getShaderPrecisionFormat) {
18631863
_supportWebGL = true;
18641864
}
18651865

1866+
if (_supportWebGL && sys.os === sys.OS_IOS) {
1867+
// Not activating WebGL in iOS UIWebView because it may crash when entering background
1868+
if (!window.indexedDB) {
1869+
_supportWebGL = false;
1870+
}
1871+
}
1872+
18661873
if (_supportWebGL && sys.os === sys.OS_ANDROID) {
18671874
var browserVer = parseFloat(sys.browserVersion);
18681875
switch (sys.browserType) {

0 commit comments

Comments
 (0)