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

@maheshkalimi/cordova-plugin-wkwebview-inject-cookie

v1.0.0

Published

Cordova plugin to inject a dummy cookie in a WKWebView instance to sync cookies.

Downloads

5

Readme

cordova-plugin-wkwebview-inject-cookie

When switching to WKWebView in Cordova for iOS, some plugins have the known issue that cookies won't be used properly on the very first start of the application, or every time using the iOS Simulator. In particular, session cookies. This is due to a missing proper sync between the underlying WKHTTPCookieStore and the WebView.

While this issue could probably only get fixed by Apple, there is a simple workaround available to get it working: Once a dummy cookie is placed into the WKHTTPCookieStore manually, the synchronization gets triggered (started) and it won't bug you ever again.

Compatibility

This workaround works for iOS 11 and later. It requires specifying the domain for which the cookie should be set.

Usage

Add an event listener for the deviceready event in your JavaScript code and call the injectCookie method with your domain and path.

Example

document.addEventListener('deviceready', () => {
  wkWebView.injectCookie('mydomain.com', 'mypath', 
    () => {
      console.log('Cookie injected successfully');
    },
    (error) => {
      console.error('Error injecting cookie', error);
    });
});

Replace "mydomain.com" with your actual domain and "mypath" with the appropriate path. If you don't need to specify a path, you can leave it empty (just ensure you keep the trailing slash to indicate no extra path).

Success and Error Handlers

You can optionally pass a success and an error handler to the injectCookie method. The success handler will be called if the cookie was injected properly, and the error handler will be called if not.

Full Usage Example

document.addEventListener('deviceready', () => {
  wkWebView.injectCookie('mydomain.com', 'mypath', 
    () => {
      console.log('Cookie injected successfully');
    },
    (error) => {
      console.error('Error injecting cookie', error);
    });
});