Microsoft MakeCode

Window.location not available

Hello everyone!

I have started working on my first game a few weeks ago and now I’m almost done and ready to publish the finished version. I’m facing an issue that is related to the main purpose of the game, which is to redirect users who complete the game to an external website. How could I achieve this? I thought that entering a very simple window.location right in my game over block would do the job but it seems I cannot do that.

Could anyone kindly help me out? Thanks a lot in advance :slightly_smiling_face:

I do not think that is possible. Maybe you could tell the player to go to this website once they complete the game with a splash block?

unfortunately the URL in question is pretty long and it could be very difficult for the users to enter it in a separate navigation bar. Do you think I could achieve this with the help of an extension?

Try a qrcode

There is another topic for this.

Do you know how could I import a QR code as an asset? Thanks

I’m not sure I’ve understood what is happening there but the demo is not working (the game is not connecting to the WebSocket). Could it be integrated into a game?

MakeCode Arcade does not allow you to access browser APIs like window.location so opening an external website automatically is not possible. This is mostly to prevent bad actors from writing games that open up malicious websites.

As for qr codes, there’s an extension for that: QR Code extension

2 Likes

Thanks for the reply. I have tried to integrate it but unfortunately it is not working as stated by other users…