I can't figure out how to use hyperlinks within rich text labels, i've tried to add bbcode to it, e.g. "Press here", where "here" is an hyperlink set with [url=http://www.google.com/]here[/url], and use a meta signal interrupt like so:

func _on_RichTextLabel_meta_clicked( meta ): print("1") if meta == "here": print("2") OS.shell_open("http://www.google.com/")

But without any success so far

Which version of Godot are you using?

The following works for me (Godot 3.0.2, Windows 10):

BBCode: [url="https://www.google.com]link[/url] GDScript:

extends RichTextLabel func _ready(): connect("meta_clicked", self, "meta_clicked"); func meta_clicked(meta): OS.shell_open(meta);

You can pass an additional argument(s) in the url as using BBCode like this: [url=,here]Link[/url]. Then you need to do something like this in your RichTextLabel to parse it:

extends RichTextLabel func _ready(): connect("meta_clicked", self, "meta_clicked"); func meta_clicked(meta): var data = meta.split(",", true); if (str(data[1]) == "here"): OS.shell_open("https://google.com");

Thank you for your reply TwistedTwigleg. I'm using Godot 2.1.4, i've tried the following with some of your handsome tweaks:

` extends RichTextLabel

const bbcode = "By clicking ACCEPT, you accept this app's [url=,https://google.com]Terms & Conditions[/url] and its [url=,https://google.com]Privacy Policy[/url]."

func ready(): set_bbcode(bbcode) connect("meta_clicked", self, "meta_clicked")

func _meta_clicked( meta ): print("&") var data = meta.split(",", true) if (str(data[1]) == "Terms & Conditions"): OS.shell_open("https://google.com") elif (str(data[1]) == "Privacy Policy"): OS.shell_open("https://google.com") `

Still doesn't work though, not entirely sure what i'm missing here.

@TwistedTwigleg said: Which version of Godot are you using?

The following works for me (Godot 3.0.2, Windows 10):

BBCode: [url="https://www.google.com]link[/url] GDScript:

extends RichTextLabel func _ready(): connect("meta_clicked", self, "meta_clicked"); func meta_clicked(meta): OS.shell_open(meta);

You can pass an additional argument(s) in the url as using BBCode like this: [url=,here]Link[/url]. Then you need to do something like this in your RichTextLabel to parse it:

extends RichTextLabel func _ready(): connect("meta_clicked", self, "meta_clicked"); func meta_clicked(meta): var data = meta.split(",", true); if (str(data[1]) == "here"): OS.shell_open("https://google.com");

I just tried your example code on Godot 3.0, it works perfectly. On Godot 2.1.4 however, links don't work.

UPDATE: I accidentally, and idiotically, ticked the Ignore Mouse flag, unchecking that box fixed everything.

No worries, we’ve all been there. I’m glad you got it working!

5 years later