Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2019.4.X, 2020.3.X, 2021.1.X

Votes

1

Found in

Issue ID

1320393

Regression

No

Application.OpenURL() not working for WebGL builds

WebGL

-

Steps to reproduce:
1. Use "Application.OpenURL()" API in Script to open a Website.
2. Build project as "WebGL" build target.
3. Trigger script in "WebGL" build.

Expected behaviour:
Website is opened in new window or tab.

Actual behaviour:
Website is loaded in same tab as the game causing the game to be exited.

Notes:
Issue only reproducible in WebGL builds.

Comments (6)

  1. _geo__

    Apr 23, 2024 08:28

    That this was qualified as a "bugfix" and acually implemented is beyond any reason. This is a BEHAVIOUR change.

    The manual reads: 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.

    So you did change the behaviour from one random PATCH release to another. Well done ... So much for Unitys SEMVER compliance, ridiculous.

  2. KillerSnails

    Mar 04, 2022 23:32

    @vinodlobo Same thing happen to me. You can try changing

    [code=CSharp]Application.OpenURL(newURL);
    [/code]

    to:

    [code=CSharp]Application.ExternalEval("window.open('" + newUrl + "','_self')");
    [/code]

  3. KillerSnails

    Mar 04, 2022 23:20

    Since Unity 5.2's documentation, it states "When executed in the web player, the page the plugin is contained in will be redirected to the url." The WebGL builds used to do the same thing too. Why change this years later?

  4. PieterAlbers

    Sep 14, 2021 14:14

    We really need the functionality for an additional parameter to define where the url will be opened.
    Can this be added please?

  5. nenadrad

    Jun 15, 2021 12:06

    We have the same problem as the previous commenter. Can an additional parameter be added to this function in order to be able to choose if the URL is going to be opened in the same window or in a new window?

  6. vinodlobo

    Jun 09, 2021 16:17

    Our application required staying within the same tab when calling an exit URL. Thus this "bug fix" broke our application. How can we call a link that stays within the same tab?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.