# Crash threejs on mobile. How to remove context programmatically?

**URL:** <https://discourse.threejs.org/t/crash-threejs-on-mobile-how-to-remove-context-programmatically/17483>\
**Category:** Questions\
**Tags:** webgl-renderer\
**Created:** [July 28, 2020, 10:15pm UTC](https://discourse.threejs.org/t/crash-threejs-on-mobile-how-to-remove-context-programmatically/17483 "2020-07-28T22:15:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DidoMarchet](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/didomarchet/32/9136_2.png) [@DidoMarchet](https://discourse.threejs.org/u/DidoMarchet)\
**Post date:** [July 28, 2020, 10:15pm UTC](https://discourse.threejs.org/t/crash-threejs-on-mobile-how-to-remove-context-programmatically/17483/1 "2020-07-28T22:15:02Z")

</div>

Hi,  
I’ve got an issue and I don’t know how to figure out it.  
I 've got a configurator that loads a canvas with a gltf model.  
The application is in Nuxt and the the navigation is ajax based.

I’ve seen during the navigation it stores a lot of webgl contexts (see image).  
If I reload the page and I disable the ajax navigation the context is always one  
and I’ve not any problems.

How can I remove context programmatically, can you share any documentation ?

Thnaks in advance and kind regards,

Davide

 ![Screenshot 2020-07-29 at 10.27.02](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/0/09a196eb2d7d54962a729a0c763c410d6d192505.jpeg)

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 29, 2020, 9:12am UTC](https://discourse.threejs.org/t/crash-threejs-on-mobile-how-to-remove-context-programmatically/17483/2 "2020-07-29T09:12:24Z")

</div>

Can you please try it with the following approach:

> [@Problem with Destroy() in Angular Component](https://discourse.threejs.org/t/problem-with-destroy-in-angular-component/16903/3):
>
> Do it like so: this.renderer.dispose(); this.renderer.forceContextLoss(); forceContextLoss() is not automatically called in dispose() because of certain compatibility issues with existing apps. More information in this PR: [https://github.com/mrdoob/three.js/pull/19022](https://github.com/mrdoob/three.js/pull/19022)

---

<div class="post-metadata">

**Author:** ![DidoMarchet](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/didomarchet/32/9136_2.png) [@DidoMarchet](https://discourse.threejs.org/u/DidoMarchet)\
**Post date:** [July 29, 2020, 10:17am UTC](https://discourse.threejs.org/t/crash-threejs-on-mobile-how-to-remove-context-programmatically/17483/3 "2020-07-29T10:17:49Z")

</div>

Thanks!  
your approach and removing some lights ( Spot light in particularly)  
seems let the application works in mobile.

it return me these errors:  
`TypeError: null is not an object (evaluating 'gl.getProgramInfoLog( program ).trim')` in mobile

`ncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.` in Chrome

But know I try to resolve.
