JS Device Back Buttom

Hi… This runs fine in PGB but not in VOLT - wonder why :slight_smile:

    <script type="text/javascript">
    // Skip history-back and goes to index	
    ! function () {
    var t;
    try {
    for (t = 0; 10 > t; ++t) history.pushState({}, "", "#");
    onpopstate = function (t) {
    t.state && location.replace("index.html")
    } catch (o) {}

Found that it is the
<video ></video> and <iframe></iframe>
in my body that ignore going to index.html

A little frustrating since its works in PGB

This isn’t something which VoltBuilder itself would cause. We don’t do anything to the code itself. It’s likely to be something introduced by the updates to Cordova and the plugins.


The solution is to insert

<script type = "text / javascript" charset = "utf-8" src = "cordova.js"> </script>

not only on index.html but all pages you trigger cordova

That makes sense. Cordova assumes you have a SPA (Single Page App), so it inserts cordova.js only the main HTML page. You have additional HTML pages: when you load one of them, the cordova.js script gets unloaded with the old page.