Forum

How do I prevent auto loading of html?

12 March 2016 01:08
I just uploaded a test b4w .html to my wordpress site. With Sketchfab and Marmoset Viewer, the models don't load until the play button is pressed. I noticed that the b4w .html loads right up which is concerning to me if I have a lot of models/scenes on my page or if they are quite large.

How do I prevent the .html from auto-loading and requiring a play button to be pressed?

Thanks for the help,
Bryson Jack
brysonjack.com
12 March 2016 10:22
Hello and welcome to the forum.

I just uploaded a test b4w .html to my wordpress site. With Sketchfab and Marmoset Viewer, the models don't load until the play button is pressed. I noticed that the b4w .html loads right up which is concerning to me if I have a lot of models/scenes on my page or if they are quite large.

Do you use the html-export?

How do I prevent the .html from auto-loading and requiring a play button to be pressed?

You can reach this if you'll use the .json export and create your own viewer. It's not difficult. There are a lot of tutorials and examples.
13 March 2016 02:58
Yeah, I used the .html export option. I take if from your response that the only way to prevent auto-loading is using json. Did I understand that correctly?
13 March 2016 11:08
Yes, you did.
But I think, there is an another way. You can use an iframe html element to integrate your scene to webpage. In this case, you should append a loading button. When the button is pressed, iframe src property will be set. For example:
<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript">
    function start_loading() {
        var iframe = document.getElementById("scene");
        iframe.src = "https://www.blend4web.com/apps/webplayer/webplayer.html?load=../../assets/capri/buildings/fountain_elephants/fountain_elephants.json";
    }
    </script>

    <style>
        body {
            overflow: hidden;
            margin: 0;
            padding: 0;
        }

        div#scene {
            position: absolute;
            width: 800px;
            height: 600px;
        }
        a#load_scene {
            background-color: black;
            color: white;
            text-decoration: none;
            display: block;
            width: 170px;
            height: 30px;
            border: 3px solid white;
            text-align: center;
            font-family: Arial;
            border-radius: 15px;
            box-shadow: 0px 0px 10px 0px rgba(50, 50, 50, 1);
            font-size: 15px;
            line-height: 30px;
            cursor: pointer;
        }
    </style>

</head>
<body>
    <a id="load_scene" onclick="start_loading()">Load 3D scene</a>
    <iframe id="scene"></iframe>
</body>
</html>

Is it expected behavior?
13 March 2016 11:11

14 March 2016 19:02
Alright. Thanks for your help. As I understand it, there isn't anyway to prevent auto-loading of an .html file but if I use .json then I can add a "Load 3D Scene" button using the code you supplied. Thanks.
 
Please register or log in to leave a reply.