GithubHelp home page GithubHelp logo

Comments (8)

goffioul avatar goffioul commented on July 20, 2024 3

What I want is to restore the native window.open behavior, but that's not possible.

from cordova-plugin-inappbrowser.

frederikbosch avatar frederikbosch commented on July 20, 2024 1

@goffioul Maybe you can put this on top of your app. Since I am fine with _system I did not try it myself.

let originalOpen = window.open;
document.addEventListener('deviceready', () => {
  // cordova should be ready by now, restore window.open
 window.open = originalOpen;
});

from cordova-plugin-inappbrowser.

mohammadrafigh avatar mohammadrafigh commented on July 20, 2024 1

It's also not working on Firefox. overwriting window functions is really a bad idea.

from cordova-plugin-inappbrowser.

frederikbosch avatar frederikbosch commented on July 20, 2024

This is also not working on iOS 12, not tested earlier versions.

from cordova-plugin-inappbrowser.

frederikbosch avatar frederikbosch commented on July 20, 2024

I am sticking to calling window.cordova.InAppBrowser.open(location, '_system'); instead of window.open.

from cordova-plugin-inappbrowser.

ibrahimAboelsuod avatar ibrahimAboelsuod commented on July 20, 2024

@goffioul Maybe you can put this on top of your app. Since I am fine with _system I did not try it myself.

let originalOpen = window.open;
document.addEventListener('deviceready', () => {
  // cordova should be ready by now, restore window.open
 window.open = originalOpen;
});

I can confirm this fix. I placed it at the bottom of the body tag in index.html file.

from cordova-plugin-inappbrowser.

azens1995 avatar azens1995 commented on July 20, 2024

You can also get the original (native-code) function back with:

window.open = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'window.open');

Well this solution was found somewhere in the old issues (Original Link), and it seems to work in our case. Hope it might help someone.

from cordova-plugin-inappbrowser.

goffioul avatar goffioul commented on July 20, 2024

Fixed by #600

from cordova-plugin-inappbrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.