Open url(another website) while staying in game

Hi There
I need to open a url while I’m playing my game.
How can I do it?

Also is there an option to open facebook native share popup?

If so please guide me :slight_smile:

What do you mean?

Like a share button that will open facebook native share popup so that I can Post/Share my thoughts or something on facebook.

And by ‘open a url’ I mean something like privacy policy or terms and conditions blogspot page

Like this?
image

yes
Please Guide

Alright, you can add a button without text after that make sure that you add an element option and put in the “Mask Texture” a logo of what you want and of course add a script element called facebook or whatever you want.

here is the code that i use for my game

var Twitter = pc.createScript('twitter');

// initialize code called once per entity
Twitter.prototype.initialize = function() {
    this.entity.element.on('click', function() {
        window.open("https://twitter.com/");
    });
};

// update code called every frame
Twitter.prototype.update = function(dt) {

};

Change the “Twitter variable to Facebook”
If you had any problem on making this thing contact me

1 Like

I’m doing exactly what you wrote

But it is not working in my facebook(Web) live game.

Can you send a screenshot pls.

This is the error that my console is showing

Blocked opening ‘WEBSITE LINK’ in a new window because the request was made in a sandboxed frame whose ‘allow-popups’ permission is not set.

When I play game from my playcanvas editor, link opens.
When I play my live game from facebook, link doesn’t open and it gives me the above error.

So, it looks like is Facebook which is blocking the pop-ups, your code is just fine. Im sure others had the same issue.

Google it without adding playcanvas to the search as is not related to it and you’ll get more meaningful results.

3 Likes

Please guide me about it too