+1 vote

Hi,

I load a game in Url with params (like: game.com/game1.php?id=23).

How I can get the Url string or only params in GDScript?

in Engine by (30 points)

Not is posible? I really need this :(

1 Answer

+3 votes

Hi,

I'm resolve this problem with javascripts

func get_parameter(parameter):
if OS.has_feature('JavaScript'):
    return JavaScript.eval(""" 
            var url_string = window.location.href;
            var url = new URL(url_string);
            url.searchParams.get(parameter);
        """)
return null

Hope this can help you

by (20 points)

Very usefull for me. Thanks!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.