question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser addListener not working

See original GitHub issue

Hello I have problem I test Capacitor on my App and I want run browser and use addListner to observe change url.

I have this code:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { Plugins } from '@capacitor/core';
const { Browser } = Plugins;

export class HomePage {
constructor(){

  Browser.addListener("browserFinished", (info: any) => {
    console.log(info.url);
  })
 
}
  async openWebpage(url: string) {
    await   Plugins.Browser.open({ url: 'http://capacitor.ionicframework.com/' });
}
}

When I pushed the button, Browser Start but addListener don’t give me event with console.log.

Please tell me what is wrong.

Ionic 4.10.3 but project is created on ionic 3 Cordova 8.1.2 (cordova-lib@8.1.1)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
dannygcommented, Oct 22, 2020

This is such a fundamental missing thing from Capacitor - for example when you need to take the user to a site to perform some action and then help them return to the app when completed. The inappbrowser in cordova was very widely used to support this. I understand why you keep closing the ticket because it is an inconvenience to incorporate a non-chrome based browser, but this is such a pain in the *ss for so many of us, for so long, it is really hindering the uptake of capacitor. A plea to the Ionicframework folks: make @ionic-enterprise/inappbrowser available to all!

5reactions
vohrahulcommented, Aug 25, 2022

@cgadam Good feedback, thank you!

I do know that for the Capacitor 3 docs, we removed the info parameter. I think we can definitely clean up that strange sentence about OAuth. I’m not sure what it means, either. 😄

A plea to the Ionicframework folks: make @ionic-enterprise/inappbrowser available to all!

You should be able to use cordova-plugin-inappbrowser in Capacitor apps. cordova-plugin-inappbrower and the Capacitor Browser plugin are fundamentally different implementations. We need a section in the docs about this for sure. I added this issue to do that: ionic-team/capacitor-plugins#1149

cordova-plugin-inappbrowser is not always a correct alternative. As in many case, we need camera and microphone permission in the in-app browser. Unfortunately, the WebView doesn’t support the required permissions and hence certain features can’t work.

It will be great to just support a urlChangeListener in the capacitor browser plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

browser.menus.onClicked.addListener not working in Firefox
I've found a solution - browser.menus.onClicked.addListener() working properly, just there is a necessity to enable logging in browser ...
Read more >
Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >
MV3: chrome.action.onClicked.addListener not working?
I found a 2019 conversation (https://groups.google.com/a/chromium.org/g/chromium-extensions/c/9WqUFsURnsc) that this was not working but ...
Read more >
Window: load event - Web APIs - MDN Web Docs - Mozilla
Note: All events named load will not propagate to Window ... Use the event name in methods like addEventListener() , or set an...
Read more >
Events | Maps JavaScript API - Google Developers
JavaScript within the browser is event driven, meaning that JavaScript responds to ... MVC events, for example, do not pass arguments within their...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found