erisu commented on issue #1246:
URL: https://github.com/apache/cordova-ios/issues/1246#issuecomment-1216281491

   You might want to try the following to see if it helps you out in anyway.
   
   Note, that the code is loading an external library for platform 
identification. `platform.js` which I have not tested or reviewed. 
   
   If you are already using any pre-existing plugin or library that can 
identify the browser/device/version, then I would suggest modfying the code to 
use that instead.
   
   I added a comment to the top of the source code with the link to where it 
originated from.
   
   ```
   <!-- Code Original Source: 
https://github.com/flutter/flutter/issues/89655#issuecomment-936666189 -->
   <!-- iOS 15 WebGL 2.0 fix (https://github.com/flutter/flutter/issues/89655) 
-->
   <!-- TODO(your_username): Remove when 
https://github.com/flutter/engine/pull/29038 will be merged to stable -->
   <script src="https://unpkg.com/[email protected]/platform.js";></script>
   <script type="text/javascript">
   function isIOS() {
     return [
       'iPad Simulator',
       'iPhone Simulator',
       'iPod Simulator',
       'iPad',
       'iPhone',
       'iPod'
     ].includes(navigator.platform)
     // iPad on iOS 13+ detection
     || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
   }
   
   if (isIOS() && parseInt(platform.os.version.split(".")[0]) >= 15) {  
     // iOS/iPadOS 15+
     HTMLCanvasElement.prototype.getContext = function (orig) {
       return function(type) {
         return type !== "webgl2" ? orig.apply(this, arguments) : null
       }
     }(HTMLCanvasElement.prototype.getContext)
   }
   </script>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to