/WebPageHost

Simple Windows Command line (CLI) tool to open URLs in WebView2 (Microsoft Edge web browser control).

Primary LanguageC#MIT LicenseMIT

Contributors Forks Stargazers Issues MIT License


WebPageHost

Simple Windows Command line (CLI) tool to open URLs in WebView2 (Microsoft Edge web browser control).
Report Bug · Request Feature · Contribute · Sponsor project

About The Project

This is a Windows simple command line interface (CLI) tool for opening web page URLs in an embedded Microsoft WebView2 control. It has a variety of options to control the behavior of the window and the embedded web browser. Further, it supports customization of the output via JavaScript which allows, for example, to use it for letting the user select anything from the web page and return it as result on standard output.

WebPageHost Screen Shot #1

WebPageHost Screen Shot #2

Note: This tool was written by me in my spare time and will be developed only sporadically.

Built With

Note: I would like to make this tool also available on Linux some day. I have chosen WinForms initially because it was the fasted way for me to put this tool together 😃, it is open source and is still supported by Microsoft. And, I still haven't given up hope that it will eventually be available on Linux including the WebView2 wrapper control. In case WPF or MAUI should be available on Linux earlier than WinForms, the source code should be migrated. Alternatively, Avalonia UI could be considered.

Getting Started

Prerequisites

Installation as Tool for Use

  1. Download the self-contained single executable file from the releases section

  2. Copy it to a location where you can easily call it, perhaps in a folder which is in your PATH environment variable

  3. Open a command prompt or PowerShell and type WebPageHost open --help

  4. Try the following simple example:

    WebPageHost open https://github.com/thgossler/WebPageHost#readme
    
  5. Try the following more complicated example:

    WebPageHost open "https://github.com/trending?since=monthly&spoken_language_code=en" -z 0.7 -s 800x1024 -x "const regex = new RegExp('github.com\\/([^\\/]+\\/[^\\/]+)', 'gm'); let m = regex.exec(window.location.host+window.location.pathname); 'Selected GitHub project: '+(m !== null ? m[1] : 'none');" --ontop
    

Installation from Source for Development

  1. Clone the repo
    git clone https://github.com/thgossler/WebPageHost.git
  2. Build
    dotnet build
  3. Run without arguments to get help
    dotnet run

Alternatively, you can open the folder in VS Code or the solution (.sln file) in the Microsoft Visual Studio IDE and press F5.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star 😉 Thanks!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.