Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to create a web window with startup flags #415

Closed
1 of 2 tasks
mynameisvasco opened this issue Sep 17, 2021 · 7 comments · Fixed by #698
Closed
1 of 2 tasks

Add the possibility to create a web window with startup flags #415

mynameisvasco opened this issue Sep 17, 2021 · 7 comments · Fixed by #698
Labels
platform: Windows status: needs triage This issue or pull request needs to be investigated type: feature request

Comments

@mynameisvasco
Copy link

mynameisvasco commented Sep 17, 2021

Is your feature request related to a problem?
Yes, developers can't use startup flags when they instantiate new web windows.

Describe the solution you'd like
It's common knowledge that browsers often accept startup flags. In my personal opinion, I think that this project would benefit if such an option was provided.
For instance, in WebWindows2 there are flags that allow us to use a proxy server --proxy-server 192.168.1.0:8080, or to change the user data directory --user-data-dir="/random_dir".

WebView2 startup arguments

Would you assign yourself to implement this feature?

  • Yes
  • No
@nothingismagick
Copy link
Sponsor Member

We do already permit command line flags to be used when the app is initiated, please see:

https://tauri.studio/en/docs/usage/guides/cli

@wusyong
Copy link
Member

wusyong commented Sep 18, 2021

But that's for the app you build right?
I think this issue is more like passing argument to webview2.
Webview2 also got some functions specific for this.

I also searched similar functions(proxy server) on Linux and macOS a few days ago.
It should be fairly easy on Linux, but become pretty difficult on mac.

@mynameisvasco
Copy link
Author

We do already permit command line flags to be used when the app is initiated, please see:

https://tauri.studio/en/docs/usage/guides/cli

Sorry but I think you didn't understand my proposal.
I was talking about passing flags to the webview itself, not to my own app, as @wusyong said the issue is related to webview2 and not to my Tauri app.

@wusyong wusyong reopened this Sep 19, 2021
@geolehmann
Copy link

geolehmann commented Oct 21, 2021

As a workaround in the meantime, you can use the std::env crate to create a temporary environment variable (it is valid as long as the app runs) at the top of your code called "WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS" to supply arguments to the webview:

env::set_var( "WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--proxy-server 192.168.1.0:8080 --user-data-dir='/random_dir'" );

@nothingismagick
Copy link
Sponsor Member

While what @geolehmann suggests is definitely possible this is a VERY DANGEROUS workaround, not to mention you can't guarantee any port is available without potentially clobbering or being listened to.

@geolehmann
Copy link

While what @geolehmann suggests is definitely possible this is a VERY DANGEROUS workaround, not to mention you can't guarantee any port is available without potentially clobbering or being listened to.

absolutely true, this should be only used for testing and until we have a better way of doing this.

@Archieeeeee
Copy link

I have same requirements to set proxy settings for webview. As for .net implementation, multi webview2 instances can be created and each one can be applied with individual start flags, I would like this function to move to tauri, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Windows status: needs triage This issue or pull request needs to be investigated type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants