Socket
Book a DemoInstallSign in
Socket

capacitor-plugin-xframe

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-plugin-xframe

Capacitor plugin to bypass CORS & same origin policy for iframes.

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

capacitor-plugin-xframe

Capacitor plugin to bypass CORS & same origin policy for iframe.

Important note

This plugin overrides the shouldInterceptRequest behavior of your webview.

As the core purpose of this plugin, shouldInterceptRequest needs to be leveraged to determine the outgoing requests and eliminate the X-Frame-Options and Content-Security-Policy headers present on the incoming responses for them to work in the embeded iframes.

Supported platforms

  • Android

Install

npm install capacitor-plugin-xframe
npx cap sync

Config options

Add these options in either capacitor.config.json or capacitor.config.ts.

userAgent

Customize the outgoing requests' User-Agent header. Useful to modify the resulted responses.

{
  ...
  "plugins": {
    "Xframe": {
      "userAgent": "<your_custom_user_agent>"
    }
  }
}

ignore

A list of domains/URLs to ignore from intercepting.

{
  ...
  "plugins": {
    "Xframe": {
      "ignore": ["google.com", "https://www.facebook.com"]
    }
  }
}

API

  • register()
  • addListener('onLoad', ...)
  • addListener('onError', ...)
  • Interfaces
  • Type Aliases

register()

register() => Promise<void>

Registers the plugin to your app.

Registering this plugin will override the shouldInterceptRequest behavior of your webview.

addListener('onLoad', ...)

addListener(eventName: 'onLoad', listener: LoadEventListener) => Promise<PluginListenerHandle> & PluginListenerHandle

Listens to requests of document type and returns some useful information.

ParamType
eventName'onLoad'
listenerLoadEventListener

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

addListener('onError', ...)

addListener(eventName: 'onError', listener: ErrorEventListener) => Promise<PluginListenerHandle> & PluginListenerHandle

Listens to failed requests (of any type)

ParamType
eventName'onError'
listenerErrorEventListener

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Interfaces

PluginListenerHandle

PropType
remove() => Promise<void>

LoadEventData

PropType
urlstring
titlestring
faviconstring

ErrorEventData

PropType
urlstring
statusCodenumber
messagestring

Type Aliases

LoadEventListener

(eventData: LoadEventData): void

ErrorEventListener

(eventData: ErrorEventData): void

Keywords

capacitor

FAQs

Package last updated on 29 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.