Git Product home page Git Product logo

webview-c's Introduction

Overview

A tiny cross-platform webview C library to build modern cross-platform GUIs.

It supports two-way JavaScript bindings (to call JavaScript from C and to call C from JavaScript).

It uses Cocoa/WebKit on macOS, gtk-webkit2 on Linux and MSHTML (IE10/11) or Edge (Chromium) on Windows.

This library is a fork of the webview library.

A Lua binding is available.

Example

Look at the example webview-example.c.

#define WEBVIEW_IMPLEMENTATION
//don't forget to define WEBVIEW_WINAPI,WEBVIEW_GTK or WEBVIEW_COCAO
#include "webview.h"

int main() {
  /* Open Lua in a 800x600 resizable window */
  webview("Minimal webview example", "https://www.lua.org", 800, 600, 1);
  return 0;
}

Build it using the following command line.

# Linux
gcc webview-example.c -DWEBVIEW_GTK=1 `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` -o webview-example

# MacOS
gcc webview-example.c -DWEBVIEW_COCOA=1 -framework WebKit -o webview-example

# Windows (mingw)
gcc webview-example.c -DWEBVIEW_WINAPI=1 -Ims.webview2/include -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32 -o webview-example.exe

Edge

The Edge (Chromium) implementation requires the extra library WebView2Loader.dll part of the Microsoft Edge WebView2 SDK. The environment variable WEBVIEW2_WIN32_PATH can be used to pass the folder containing the extra library.

The WebView2 Runtime shall be installed with the same architecture, x64 or x86.

There is a minimum Microsoft Edge version required, here 86.0.616 (full compatibility: 90.0.818) for 1.0.818.

The WebView2 SDK may fail to auto detect the WebView2 Runtime installation path to use, you could indicate the correct installation path by using the environment variable WEBVIEW2_BROWSER_EXECUTABLE_FOLDER.

The Microsoft Edge Stable channel is unavailable for WebView2 usage to prevent apps from taking a dependency on the browser in production. If you still want to use an Microsoft Edge Stable channel for WebView2 you may create a symbolic link named Edge-Application using the following command as administrator.

cd "\Program Files (x86)\Microsoft"
mklink /D Edge-Application Edge\Application

Note that this implementation creates a folder for the user data, you could specify a user data folder by using the environment variable WEBVIEW2_USER_DATA_FOLDER.

webview-c's People

Contributors

javalikescript avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.