Cleanup module

07 May 2016 14:36
In my React app, when I go to a page with b4w initiated, then go back and enter the page again, I get multiple errors and warnings in chrome.

This is probably because I run the
multiple times. How do i clean the b4w object when changing between pages?
10 May 2016 16:33
May be I don't completely understand you, but all JavaScript objects are deleted when the user leaves a web page. The warnings you see in the browser console are simply printed again after the user comes back to your Blend4Web-powered page.

In fact, these warnings are very strange. A simple example blend file and/or source code snippet would be appreciated.
The Founder | Twitter | Facebook | Linkedin
10 May 2016 21:50
The problem is, unlike traditional webpages, the user actually never leaves. HTML is just removed and added using JS. This code is run every time someone visits a page in my app:

b4w.register("example_main", function(exports, require) {

    var m_app    = require("app");
    var m_data   = require("data");

    exports.init = function() {
            canvas_container_id: "canvas_cont",
            callback: init_cb,
            physics_enabled: false,
            media_auto_activation: false

    function init_cb(canvas_elem, success) {
        m_data.load("../"+jsonFile, load_cb);

    function load_cb(root) {



Instead of registering "example_main", should I just maybe remove the loaded scene, and load another one when user enters a different page?
11 May 2016 00:12
Okay I managed to solve it using:

It's a documented feature, though very hard to find:
11 May 2016 11:24
These methods can also be helpful for loading/unloading scenes without resetting the engine:
load, unload
Please register or log in to leave a reply.