user4589444
user4589444

Reputation:

WebGL - Open URL in new tab?

How to open URL in new tab for WebGL?

Tried Application.OpenURL("url"). But it's opens a tab in same window

Thanks

Upvotes: 2

Views: 4755

Answers (2)

icoum
icoum

Reputation: 221

Thankfully, "Application.OpenURL" now opens your URL in a new tab, as you can see in the official Unity documentation.

WebGL: From version 2019.4.25f1, 2020.3.5f1, 2021.1.2f1, and 2021.2.0a11, Application.OpenURL opens url in a new browser tab. In previous versions, Application.OpenURL opens url in the same browser tab, which terminates the running Unity application.

Thus, it is the right solution to your question.

If you still want to try valyard's solution, shared by Mijago, be aware that is at least partially deprecated.
I got that message from my browser (Firefox) when trying it today.

The JavaScript function 'Pointer_stringify(ptrToSomeCString)' is obsoleted and will be removed in a future Unity version. Please call 'UTF8ToString(ptrToSomeCString)' instead.

Have a nice day :)

Upvotes: 4

Related Questions