wails
wails copied to clipboard
Open URL directly
Is your feature request related to a problem? Please describe.
- Open the App
- Enjoy pronhub
Faster then
- Start Chrome
- Open a new Tab
- Click the location bar
- Select pronhub.com in the recently history
- Do lovely things
Describe the solution you'd like
func main() {
err := wails.Run(&options.App{
//
URL: "https://pronhub.com",
//
})
if err != nil {
log.Fatal(err)
}
}
Describe alternatives you've considered
No response
Additional context
No response
Webview is a better project for this use case https://github.com/WebView/webview
I've actually wanted this feature for a while, but for legitimate use cases. Just because wails offers far easier window customisations, so after seeing your feature request and some trial and error I had it working with an external URL I used a custom asset handler, it's not the prettiest solution, but it works for everything I needed it to. Not posting code because I don't know how leaanthony would feel about it, just letting you know it's possible.
Honestly, if you want to wrap external websites there are more appropriate projects. Wails is for desktop apps, not for light wrappers around websites.
I wouldn't be using it for external sites, I would use it for locally hosted web apps that would benefit from having an easy-to-launch wrapper. Sure there are more practical solutions but none of them offer the extensive wails window options that I love so much. I can see that this isn't what you want for the project but there are legitimate use cases, Electron even allows opening a URL in the window, I know it wouldn't be that hard to implement a new struct field so you could use a custom "startURL" with no asset handlers or script injections, maybe just think about it?
I wouldn't be using it for external sites, I would use it for locally hosted web apps that would benefit from having an easy-to-launch wrapper. Sure there are more practical solutions but none of them offer the extensive wails window options that I love so much. I can see that this isn't what you want for the project but there are legitimate use cases, Electron even allows opening a URL in the window, I know it wouldn't be that hard to implement a new struct field so you could use a custom "startURL" with no asset handlers or script injections, maybe just think about it?
forget that frontend just put
<meta http-equiv="refresh" content="0;url=https://example.com" />
or
<script>window.location='https://example.com'</script>
in index.html
forget that frontend just put
<meta http-equiv="refresh" content="0;url=https://example.com" />
or<script>window.location='https://example.com'</script>
in index.html
wow, don't I feel stupid still, what you originally proposed would be a very nice to have
forget that frontend just put
<meta http-equiv="refresh" content="0;url=https://example.com" />
or<script>window.location='https://example.com'</script>
in index.htmlwow, don't I feel stupid still, what you originally proposed would be a very nice to have
I know they wouldn't do it, or I would have made a suggestion last year.
I have a desktop app which, in effect, searches a database of links and presents them. I'd like to be able to click a link and have it open in a system browser... is this case possible, and if so how?
For various reasons, Webview is not appropriate for this project.
Thanks!
I'd like to be able to click a link and have it open in a system browser... is this case possible, and if so how?
Your question should have been in a new discussion but none-the-less, there is an API for this BrowserOpenURL
@overrnet Thanks! That works perfectly, much appreciated.
I want this feature too, but not only open directly. I want to open an url, and inject a javascript file into it, fetch and send web page data to golang functions to save web contents which load dynamic.
I used electron to implement this feature, inject a js into a webview, and watch DOM events, but this approach does not work in wails.
@codepiano Not sure I understand -- is this a URL on the web? So you might want to open https://www.yahoo.com and inject JS into that HTML? Or is the HTML you want to modify producing with your go code?
And do you want to display this HTML in the Wails app's window, or in the system browser (e.g., Safari or Edge)?
@codepiano Leads the user to open a Wails App that contains a modified financial website. that's a good idea.
@codepiano Not sure I understand -- is this a URL on the web? So you might want to open https://www.yahoo.com and inject JS into that HTML? Or is the HTML you want to modify producing with your go code?
And do you want to display this HTML in the Wails app's window, or in the system browser (e.g., Safari or Edge)?
actually I want to open an web url like tiktok in wails, then inject a js into it. After user login, the js will fetch information like your favorite videos id... etc, and then send these ids to wails golang backend, download these viedoes and save them to disk.
@codepiano Leads the user to open a Wails App that contains a modified financial website. that's a good idea.
just want to download some viedoes, 😃
@codepiano its not a good idea
I have a case to open another page. Users need token to access web site api and the site requires users to login and set token in cookie or storage. If user open app without token, the app will navigate to the website to login and fetch token. then go back to app.
@mediawall so what is your question? Sounds like you need to implement some sort of OAuth??
This is a very practical function. For example, when doing an unofficial program on a certain website, the verification code problem is unavoidable. We need to be able to display the verification page. For your own website, it is also good to display an extra page, which can be updated on the server without requiring the user to update the program. Jumping is a solution, but it is not easy to use. For example, my program is a local application, but it needs some Participation in web pages... If this is not a technical issue, I hope to listen to the needs of users and not be limited to local.
This will be available in v3 👍
Make Wails great again
I also would like to open external URLs. My use case would be to keep multiple websites (external URLs) opened in a split-view window (multiple webview in one window), see also #1997
Any updates on this ?