如何在 WebGL 新选项卡中打开 URL?
尝试过Application.OpenURL(“url”)。但它会在同一窗口中打开一个选项卡
谢谢
最佳答案
幸运的是,“Application.OpenURL”现在会在新选项卡中打开您的 URL,如 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.
因此,这是解决您问题的正确方法。
如果你还想尝试valyard's solution ,由 Mijago 共享,请注意,它至少已部分弃用。
今天尝试时,我从浏览器(Firefox)收到了这条消息。
The JavaScript function 'Pointer_stringify(ptrToSomeCString)' is obsoleted and will be removed in a future Unity version. Please call 'UTF8ToString(ptrToSomeCString)' instead.
祝你有美好的一天:)
关于browser - WebGL - 在新选项卡中打开 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35021091/