browsersWebview

Sandboxed iframes

Webview Plugins can be used to create all kinds of interfaces using HTML and JS.

Create a Webview

circle-info

You can only create one webview per slot.

// Create a panel that appears below the home screen toolbar
const panel = ctx.newWebview({
    slot: "after-home-screen-toolbar",
    fullWidth: true,
    autoHeight: true,
})

Options

interface WebviewOptions {
    slot: "screen" |
        "fixed" |
        "after-home-screen-toolbar" |
        "home-screen-bottom" |
        "schedule-screen-top" |
        "schedule-screen-bottom" |
        "anime-screen-bottom" |
        "after-anime-entry-episode-list" |
        "after-anime-episode-list" |
        "before-anime-entry-episode-list" |
        "manga-screen-bottom" |
        "manga-entry-screen-bottom" |
        "after-manga-entry-chapter-list" |
        "after-discover-screen-header" |
        "after-media-entry-details" |
        "after-media-entry-form"

    // Iframe options
    className?: string
    style?: string
    width?: string
    height?: string
    maxWidth?: string
    maxHeight?: string
    zIndex?: number
    // Iframe height is automatically adjusted to fit the webview content
    autoHeight?: boolean
    // Iframe width takes the entire available width
    fullWidth?: boolean
    hidden?: boolean

    // Applies when slot = "screen"
    sidebar?: {
        label: string,
        icon: string,
    }
    
    // Applies when slot = "fixed"
    window?: {
        draggable?: boolean
        defaultX?: number
        defaultY?: number
        defaultPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
        frameless?: boolean
    }
}

Screen Slot

A Webview created with the slot screen will be rendered in its own page.

Fixed Slot

Events

Rendering

HTML

Messages

Example

This example uses Preact, a lightweight React alternative suitable for webviews.

Last updated