Cordova opens the web page how to jump back.

1, scenario: login is a unified login page. After authentication, bring the certified information and then jump back.
use InAppBrowser under cordova to jump to the verification page and fail to jump back after verification

Code of the jump
`cordova.InAppBrowser.open (config.djgLoginUrl +"? CallbackUrl=" + window.location.href,
"_ blank", "location=no,toolbar=yes,toolbarposition=top,closebuttoncaption= off"); `

after verifying ok, php will echo < script > window.location.href=$CallbackUrl < / script >
$CallbackUrl: file:/android_asset/www/index.html-sharp/student/courseIndex
but cannot jump back. Now url is http://xxxx.com

question: how can I jump back to the app developed by cordova after verification

Mar.21,2021

refer to a foreign post link

this is my solution code

//
      Slogin(){
        var _this = this;
        var win = cordova.InAppBrowser.open(config.djgLoginUrl + '?CallbackUrl=' + window.location.href, '_blank', 'location=no,hidden=yes');
        win.show();
        win.addEventListener("loadstop", function() {
          var loop = setInterval(function () {
            win.executeScript(
              {
                code: "document.body.innerHTML"
              },
              function (values) {
                var name = values[0];
                if (name.indexOf('sos123') >= 0) {
                  clearInterval(loop);
                  //Token
                  localStorage.setItem('StudentToken',name)
                  _this.$router.push({path:"/student/styleExam"});
                  win.close();
                }
              }
            );
          });
        });
      },

the InAppBrowser plug-in is used, and
the backend will output echo < script > document.write ('sos123: user ID') < / script >


in the past two days, there has just been a demand similar to sso. The idea is inspired by the main building and found github all the way. The inAppBrowser of the latest dev branch already supports passing values as postMessage. There is no need for such a violent surveillance mode.
the first step is to install 3.1.0-dev 's inAppBrowser, and uninstall it if it has already been installed.
cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser.git
and then you can use the new api

var url = "https://braintree.github.io/popup-bridge-example/this_launches_in_popup.html";
iab = cordova.InAppBrowser.open(url, '_blank');
iab.addEventListener('message', function(e) {
    var msg =  JSON.stringify(e);
    iab.close();
    console.log("Message received: " +msg);
    alert(msg);
});
iab.addEventListener('loadstop', function (e) {
    iab.executeScript({
        code: "(function() { " +
            "var body = document.querySelector('body'); " +
            "var button = document.createElement('button'); " +
            "button.innerHTML = 'Click Me'; " +
            "body.appendChild(button); " +
            "button.addEventListener(\"click\",function(e){" +
                "var message = {my_message: 'Hello World!'};" +
                "webkit.messageHandlers.cordova_iab.postMessage(JSON.stringify(message));" + 
            "},false);" +
        "})(); "
    });
});

Note that the parameter passed by the webkit.messageHandlers.cordova_iab.postMessage (msg) method must be a json string, otherwise the external message event cannot be triggered.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37c1e-2b838.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37c1e-2b838.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?