Simple/Best way to load Web App as Windows Desktop Application?

大城市里の小女人 提交于 2019-12-03 07:38:02

问题


Hello basically I have a web app built using html5/php, etc. Its a music player, similar to spotify and pandora. I want to distribute the web app for as a desktop application so people can run it straight from their desktop without opening a browser. I would not like a browser like system, just have the web view loaded (similar to just loading a webview in iOS) (no tabs no url bar, etc)

I heard of Prism but that is discontinued and I can't find a download link anywhere. Is there anything you suggest?

For Mac Os X, i found FluidApp, which seems to work great as it builds a stand alone app.

For iOS I can simply load the web app via a webview and it works great, just what i needed. For android i basically load a webview as well.

Windows just got me stump into loading the webapp via a standalone desktop app. So if anyone could help me out, it will be greatly appreciated!


回答1:


A simple VB.NET application should do the trick. Just create a new Windows Froms project, double click on the form, mark everything an paste this:

Public Class Form1

    '############## Settings ##############'

    'Change to your URL
    Dim url As String = "http://google.de"

    'Change to the text the window title should have
    Dim title As String = "Your Title here"

    'Change to the windows size you wish to use
    Dim window_size As Size = New Size(800, 600)
    '                                  ^X^, ^Y^
    '########### End of Settings ##########'

    Dim WithEvents WebBrowser1 As New WebBrowser

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Me.Text = title
        Me.Size = window_size

        Me.Controls.Add(WebBrowser1)

        WebBrowser1.Dock = DockStyle.Fill
        WebBrowser1.Navigate(url)

    End Sub

    Private Sub WebBrowser1_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated

        Dim elements As HtmlElementCollection
        elements = WebBrowser1.Document.GetElementsByTagName("img")

        For Each element As HtmlElement In elements
            element.SetAttribute("border", "0")
        Next
    End Sub
End Class

Edit the settings and press F5 to run. Voila, you should see you WebApp in a Desktop Application.




回答2:


I myself was looking for an all around solution for awhile. I tried everything from TideSDK, AppJS, Appcelerator Titanium, native code in VB.NET, XCode, Python, C++, Electron, node-webkit, etc: Basically you name it I've tried it.

Note Electron is nice, but it only runs on 64bit processors. So node-webkit is good if you want to run your app on 32bit processors.

So I decided to build my own open source solution called WebDGap.

Currently WebDGap runs on Windows, Linux, Mac OS X, Google Chrome and as a web application!

Watch the How To Video to learn, well how to use the app obviously.

Here's a screenshot.

Mac user's can merge your exported app into 1 .app mac file. This can be done with Automator (and a little shell scripting).

There's also a coding playground I made for mobile users that has this feature built in called kodeWeave.

Here's a Tic-Tac-Toe game I'm going to export as a Mac App:

Now the web app is running as a native Mac application!




回答3:


Google chrome has a 'save shortcut' in the options menu. Menu>tools>create shortcut... I think. (Posting from mobile)

When you open the shortcut, it will open it in it's own window. like an standalone app. Hope this helps.

Edit: prism was from mozilla. I'm sure there is a similar function in firefox.



来源:https://stackoverflow.com/questions/17225826/simple-best-way-to-load-web-app-as-windows-desktop-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!