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

window.open is not working on mac #1522

Closed
askie opened this issue Jul 3, 2022 · 9 comments
Closed

window.open is not working on mac #1522

askie opened this issue Jul 3, 2022 · 9 comments
Labels
awaiting feedback More information is required from the requestor

Comments

@askie
Copy link

askie commented Jul 3, 2022

Description

on windows :

window.open("./test.htm","_blank");

on wails dev: work good, a browser window will open the test.html .

but ,on wails build, can not open the test.html file,browser window report error.

on mac dev and build mod : window.open not working.

To Reproduce

<button onclick="go()">go</button>
<script>
function go(){
window.open("test.html","_blank");
}
</script>

Expected behaviour

on windows and mac system, need window.open working properly.

Screenshots

No response

Attempted Fixes

No response

System Details

Scanning system - Please wait (this may take a long time)...Done.

System
------
OS:             MacOS
Version:        12.4
ID:             199506
Go Version:     go1.18.3
Platform:       darwin
Architecture:   amd64

Wails
------
Version:        v2.0.0-beta.37

Dependency                      Package Name    Status          Version
----------                      ------------    ------          -------
xcode command line tools        N/A             Installed       2395
npm                             N/A             Installed       8.11.0
*upx                            N/A             Available
*nsis                           N/A             Available

* - Optional Dependency

Diagnosis
---------
Your system is ready for Wails development!
Optional package(s) installation details: 
  - upx : Available at https://upx.github.io/
  - nsis : Available at https://nsis.sourceforge.io/Download

Additional context

No response

@leaanthony
Copy link
Member

Yes, that won't work as you are trying to load a file that does not exist. Your best bet would be to use a data-uri for the html, eg

data:text/html,%3Ch1%3EHello%2C%20World%21%3C%2Fh1%3E

@leaanthony leaanthony added the awaiting feedback More information is required from the requestor label Jul 3, 2022
@askie
Copy link
Author

askie commented Jul 3, 2022

@leaanthony Can you give me a demo code? thx!

@askie
Copy link
Author

askie commented Jul 3, 2022

on windows the below code is working:

popwin=window.open("","_blank","height=600,width=400");
popwin.document.write("<h2>hello world</h2>");

but on macos, it's not working, the new window not open

@leaanthony
Copy link
Member

@leaanthony Can you give me a demo code? thx!

No, sorry. I don't have any code that does this.

@csterritt
Copy link

Supplying a full URL also doesn't work on Mac (don't have windows, so I can't test there):

window.open('https://www.google.com', '_blank')

Thanks!

@leaanthony
Copy link
Member

Did you check Apple's documentation on whether WkWebView supports window.open?

@csterritt
Copy link

@leaanthony Sorry, my bad, I didn't check Wails's documentation! Turns out BrowserOpenURL does exactly what I want. Thanks!

@leaanthony
Copy link
Member

We don't officially support multi window so YMMV.

@leaanthony
Copy link
Member

Fixed by/Duplicate of #1480.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback More information is required from the requestor
Projects
None yet
Development

No branches or pull requests

3 participants