kioskweb

package module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 10 Imported by: 0

README

go-kioskweb

Description

go-kioskweb opens browsers in kiosk mode. This package has following features.

  1. go-kioskweb supports for IE, Edge, Google Chrome, Firefox
  2. In the startup of Windows 10 Tablet Mode, it is possible to launch and display a kiosk mode browser.

Usage

// +build windows

package main

import (
	"context"
	"log"
	"time"

	"github.com/kazufusa/go-kioskweb"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
	defer cancel()

	err := kioskweb.Open(
		"https://github.com",
		kioskweb.Config{Browser: kioskweb.IE, WaitCtx: ctx},
	)
	if err != nil {
		log.Fatal(err)
	}
}

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	// Internet Explorer
	IE browser = "IE"
	// Microsoft Edge
	Edge browser = "Edge"
	// Google Chrome
	Chrome browser = "Chrome"
	// Firefox
	Firefox browser = "Firefox"
)

Variables

View Source
var (
	// ErrHandleNotFound is occured when the newly opend browser handler is not found.
	ErrHandlerNotFound = errors.New("the window handler of newly opened kiosk browser is not found")
)

Functions

func EnumWindows

func EnumWindows(lpEnumFunc uintptr, lParam uintptr) (err error)

func GetWindowTextW

func GetWindowTextW(hwnd syscall.Handle, text *uint16, nMaxCount int32) (err error)

func Open added in v1.0.1

func Open(url string, config Config) error

Open opens url with the user selected browser which is in kiosk mode

func SetForegroundWindow

func SetForegroundWindow(hwnd syscall.Handle) (err error)

Types

type Config

type Config struct {
	// Browser is the browser name to open kiosk web applcation.
	// IE, Edge(Default), Chrome or Firefox are available.
	Browser browser
	// WaitCtx  is the maximum time to wait for the URL to become available.
	WaitCtx context.Context
}

Config is common configuration for browser and wait time

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL