Identifier "Javascript" Not declared in the current scope

Godot Version

Godot4.2.2

Question

Identifier “Javascript” Not declared in the current scope

i have a script that looks like this, it’s purpose is to redirect someone to a website when the button is pressed

if OS.get_name() == “HTML5”:
JavaScript.eval(“window.location.href=‘https://example.com’”)
else:
OS.shell_open(“https://example.com”)

I “borrowed” this code from somewhere else, so it may be from an older version

Must have changed in 4.0, a updated code would use JavaScriptBridge.eval

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.