Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

Ionic 3 ThemeableBrowser on loadStop executeScript is not working properly for IOS

$
0
0

@PallabTechno wrote:

Hi, I am using ThemeableBrowser in my Ionic 3 app. and there on loadstop I execute some javascript code. Now I am facing issues in iOS. That script is working only for the 1st web page.
But for the rest pages, scripts are not working on iOS devices. And another issue I want to open an external link from web to the external browser like safari. But it is opening in the background.

const options: ThemeableBrowserOptions = {

    statusbar: {
      color: '#155e9b'
    },

    toolbar: {
      height: 42,
      color: '#155e9b'
    },

    backButton: {
      wwwImage: 'assets/images/arrow.png',
      imagePressed: 'back_pressed',
      align: 'left',
      event: 'backPressed'
    },

    title: {
      color: '#ffffff',
      showPageTitle: true,
      staticText: btname
    },

    closeButton: {
      wwwImage: closebutton,
      imagePressed: 'close_pressed',
      align: 'right',
      event: 'closePressed'
    },

    backButtonCanClose: true,
    clearcache: true
  };

  let browser: ThemeableBrowserObject = this.themeableBrowser.create(postUrl, '_blank', options);

  if (this.assignedDomainArr.length === 1) {

    browser.on('closePressed').subscribe(data => {
      this.navCtrl.setRoot(ProfilePage);
    });

    browser.on('backPressed').subscribe(data => {
      this.navCtrl.setRoot(ProfilePage);
    });
  }


  browser.on("loadstart").subscribe(event => {
    this.apicalls.showFixLoader("", "Please wait...");
  });

  var hrefVal = ""
  browser.on("loadstop").subscribe(event => {
    browser.executeScript({
      code: 'localStorage.removeItem("hrefVal");document.getElementsByClassName("header-toogle")[0].style.display="none";'
    });

    this.apicalls.hideLoader();

    let self = this;

    setInterval(function () {

      browser.executeScript({ code: '$(".anchoorlink").click(function(event){event.preventDefault();  localStorage.setItem("hrefVal", this.href)});  localStorage.getItem("hrefVal")' }).then((data) => {

        if (data != '') {
          console.log(data);
          browser.executeScript({
            code: 'localStorage.removeItem("hrefVal");'
          });
          self.openBrowser(data);
        }
      });
    }, 1000);
  });

openBrowser(url){
const sbrowser = this.appbrowser.create(url, “_system”);
}

My package.json dependencies :
“dependencies”: {
@angular/animations”: “5.2.11”,
@angular/common”: “5.2.11”,
@angular/compiler”: “5.2.11”,
@angular/compiler-cli”: “5.2.11”,
@angular/core”: “5.2.11”,
@angular/forms”: “5.2.11”,
@angular/platform-browser”: “5.2.11”,
@angular/platform-browser-dynamic”: “5.2.11”,
@ionic-native/core”: “4.20.0”,
@ionic-native/in-app-browser”: “^4.20.0”,
@ionic-native/native-storage”: “^4.20.0”,
@ionic-native/network”: “^4.20.0”,
@ionic-native/spinner-dialog”: “^4.20.0”,
@ionic-native/splash-screen”: “4.20.0”,
@ionic-native/status-bar”: “4.20.0”,
@ionic-native/themeable-browser”: “^4.20.0”,
@ionic-native/toast”: “^4.20.0”,
@ionic/storage”: “2.2.0”,
“cordova-android”: “^8.1.0”,
“cordova-browser”: “6.0.0”,
“cordova-plugin-inappbrowser”: “^3.2.0”,
“cordova-plugin-native-spinner”: “^1.1.3”,
“cordova-plugin-nativestorage”: “^2.3.2”,
“cordova-plugin-network-information”: “^2.0.2”,
“cordova-plugin-themeablebrowser”: “^0.2.18”,
“cordova-plugin-x-toast”: “^2.7.2”,
“ionic-angular”: “3.9.9”,
“ionicons”: “3.0.0”,
“rxjs”: “5.5.11”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.29”
}

Please help me to get rid of this situation.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>