# Extension to interact with the web in exported games

**URL:** https://forum.makecode.com/t/extension-to-interact-with-the-web-in-exported-games/4262
**Category:** Arcade
**Tags:** extension
**Created:** [November 3, 2020, 9:31pm UTC](https://forum.makecode.com/t/extension-to-interact-with-the-web-in-exported-games/4262 "2020-11-03T21:31:36Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [November 3, 2020, 9:31pm UTC](https://forum.makecode.com/t/extension-to-interact-with-the-web-in-exported-games/4262/1 "2020-11-03T21:31:36Z")

</div>

Let’s start with the demo: an **exported** Arcade game that opens a new browser tab.

> **[arcade-browser](https://pelikhan.github.io/arcade-browser/)**
>
> Allows to update new browser tabs with MakeCode Arcade

**In general, Arcade games are completely sandboxed…** So how can we open a new tab? Let’s take a look.

The `control.simmessages` is a new API added in Arcade to support the JACDAC simulator… but you can use it too **in GitHub Pages**.

`simmessages` allow to send or receive a data payload to the hosting iframe of the simulator (those messages are ignored on hardware). In [arcade.makecode.com](http://arcade.makecode.com), you are not allowed to inject custom javascript to handle those messages BUT… **if you export your game to GitHub, you put your custom logic** and do all kinds of cool features.

In this demo, the game calls a “open url” function

> <https://github.com/pelikhan/arcade-browser/blob/master/test.ts#L3>

That function sends a “web open url” message over `control.simmessages`.

> <https://github.com/pelikhan/arcade-browser/blob/master/main.ts#L7>

On the browser javascript side, we’ve added custom code to handle the message.

> <https://github.com/pelikhan/arcade-browser/blob/master/assets/js/loader.js#L99>

and we’ve registered a function handler for the “web” channel

> <https://github.com/pelikhan/arcade-browser/blob/master/assets/js/custom.js#L7>

So eventually, through a few layers your message from the MakeCode Arcade game routes itself to the handler that calls `window.open`.

Full sources [https://github.com/pelikhan/arcade-browser](https://github.com/pelikhan/arcade-browser)

---

_[View the full topic](https://forum.makecode.com/t/extension-to-interact-with-the-web-in-exported-games/4262)._
