简体   繁体   English

Cordova Inappbrowser - window.history.back 和 forward 在 executescript 函数中不起作用

[英]Cordova Inappbrowser - window.history.back and forward won't work inside executescript function

I set the location to no to hide the default bar of the in-app browser and used inserts and execute a script to create my own bar.我将位置设置为 no 以隐藏应用程序内浏览器的默认栏,并使用插入并执行脚本来创建我自己的栏。 The rest of the buttons I added are working except for the back and a forward button that I created.除了我创建的后退和前进按钮外,我添加的其余按钮都可以使用。 I've already tried我已经试过了

navigator.app.backHistory();
window.history.back();
window.history.go(-1);
history.go(-1);
history.back();
history.go(-1);

but not of them works.但不是他们的作品。 I will be compiling this app in Android and ios.我将在 Android 和 ios 中编译这个应用程序。

Never mind.没关系。 I got used to how I did my other buttons where i had to use functions from cordova plugins.我习惯了我如何做我的其他按钮,我必须使用来自cordova插件的功能。 That is why i put in in a callback of an executescript within the callback of another execute script which calls a file: 'externaljavascriptfile.js'这就是为什么我在另一个调用文件的执行脚本的回调中放入一个执行脚本的回调:'externaljavascriptfile.js'

I just realized, I didn't have to do that.我才意识到,我不必那样做。 and just put然后把

    window.history.back();

and

    window.history.forward();

in the js file ^^;在js文件中^^; Silly mistake :B愚蠢的错误:B

    $('body').on('click','#customheader-back',function()
    {
        window.history.back();
    });

    $('body').on('click','#customheader-forward',function()
    {
        window.history.forward();
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM