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.

Close method not working and showing ambiguous console warning

See original GitHub issue

I am trying to implement OAuth with BrowserTab, I have successfully opened a BrowserTab with .openUrl() and also implemented deeplinks and through that its successfully opens my app and my app continues to work, I am able to pass on the control to my app in Android , But in iOS deeplinks works fine but my app continues in background only BrowserTab remains on foreground and i am trying to close the BrowserTab through close() method it doesn’t work and says:

screen shot 2017-06-20 at 11 39 15 am

I am using chrome inspector

here is my code snippet:

public selectTracker(id) {
  id = parseInt(id)
  let url;
  switch(id) {
         case 1 : url = 'http://oauth1.com/';
           break;
         case 2 : url = 'http://oauth2.com/';
           break;
    }

  this.browserTab.openUrl(url);

  (window as any).browserTab = this.browserTab;

  setTimeout(()=>{ // <--- I tried this as well 
      this.browserTab.close();
  },1000);
}

Seems like there is problem with the BrowserTab API since console warning doesn’t make sense, I tried removing and installing the plugin again doesn’t work.

Also, how should I go about closing the BrowserTab if this isn’t the correct way.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
heberallredcommented, Mar 27, 2019

We had the same issue with OAuth with BrowserTab until we did a custom URL scheme which for some reason closes the tab when called.

So instead of: window.close(); try myapp://close Note: replace “myapp” with the custom URL scheme of your own app. You set this up using a package such as “cordova-plugin-customurlscheme”.

We’ve had instances where we have to call this twice to get it to close for some reason. The /close part of the custom URL has no known significance, but the “myapp://” part of the URL somehow triggers your app and closes the BrowserTab.

1reaction
heberallredcommented, Mar 29, 2019

@ltlbsteed on our team actually found this solution in an article somewhere, and implemented it into our code. I figured I would post here for the benefit of anyone who is trying to solve this issue because it can use up a lot of time to solve. If the main thread of the program didn’t freeze while the BrowserTab is open, then it would be a non-issue because the main thread could close it, but for now this is the only work-around we’ve found.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting an "ambiguous redirect" error - bash - Stack Overflow
Adding quotes around the variable seems to be a good way to deal with the "ambiguous redirect" message: You tend to get a...
Read more >
Ambiguous reference between enums when using a service ...
I'm in the process of porting some old ASMX code over to WCF. Some of the methods have enumerated constants as return values...
Read more >
"The method X is ambiguous for the type Y" Java ambiguous ...
Suppose we have a java program like below. Above program compiles perfectly and when we run it, it prints “String”.
Read more >
Google Analytics Errors - Tag Assistant Help
The value for parameter 'X' in method 'X' should not be quoted ... that you add the Google Analytics tracking code onto this...
Read more >
Auto Layout Guide: Ambiguous Layouts - Apple Developer
These ambiguities appear as warnings in the issues navigator, errors in the ... and then call one of the following methods from the...
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