npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mailbutler/cordova-plugin-browsertab

v0.2.0

Published

In-app browser tabs for Android and iOS

Downloads

13

Readme

cordova-plugin-browsertab

Cordova plugin to open URLs in browser tabs with access to cookies (iOS, Android)

Platforms

Usage

To open a URL in an in-app browser tab:

cordova.plugins.browsertab.openUrl(url, options, onSuccess, onError);

Your Cordova WebView continues to run Javascript. So you can close the tab later: WARNING!!! On Android this method doesn't work. User should close this window manually or you can do it in JS open app by navigate to <scheme of app>://

cordova.plugins.browsertab.close();

You can also open a URL in the system browser:

cordova.plugins.browsertab.openUrlInBrowser(url, options, onSuccess, onError);

In this case, your WebView will not continue to run Javascript until you switch back to the app.

oAuth

Typically you would use this plugin for authentication flows, to grab oAuth tokens. In this case, you will have to supply the scheme option to be used in iOS 11:

cordova.plugins.browsertab.openUrl(url, {scheme: "myapp://"}, onSuccess, onError);

On iOS 11 the user will have an additional dialog before the flow proceeds, telling the user your app wants to authenticate with a certain website.

Note that the oAuth flows such as facebook login will only agree to redirect you to a web url that begins with http:// or https://. That means a successful login will still leave the user looking at the browser tab. Thus, you should redirect them to your website, which should then use location.href = "myapp://something?parameters=here"; to send a message back to your Cordova app. Alternatively, you can set up Universal Links on iOS and App Links on Android to make this step more seamless (and possibly more future-proof if custom URL schemes ever go away).

In any case, you will need a plugin such as this one to run Javascript on handleOpenURL. This returns control to your WebView and you can now call close() on the previously opened browser tab.

Building

Install Cordova if you haven't already:

npm install -g cordova

Then from the root directory:

cd demo
cordova platform add ios
cordova run ios
cordova platform add android
cordova run android

Development

During development if you want to make changes to the plugin you need to force a rebuild and add the plugin from source, like so (from the demo directory):

cordova plugin remove cordova-plugin-browsertab
cordova plugin add ../plugin

To refresh the platform build:

cordova platform remove ios
cordova platform add ios

To set breakpoints, etc, open the project in the code editor:

cordova platform add ios
open platforms/ios/BrowserTabDemo.xcworkspace