Making script URL dynamic
Signed-off-by: David Négrier <d.negrier@thecodingmachine.com>
This commit is contained in:
parent
86cb118378
commit
71a5e29ae4
@ -1,10 +1,14 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<script src="http://play.workadventure.localhost/iframe_api.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script>
|
<script>
|
||||||
|
var script = document.createElement('script');
|
||||||
|
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
||||||
|
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
||||||
|
script.setAttribute('src', document.referrer + 'iframe_api.js');
|
||||||
|
document.head.appendChild(script);
|
||||||
|
|
||||||
|
window.addEventListener('load', () => {
|
||||||
WA.room.changeTile([
|
WA.room.changeTile([
|
||||||
{x: 0, y: 0, tile: 92, layer: 'changeTile'},
|
{x: 0, y: 0, tile: 92, layer: 'changeTile'},
|
||||||
{x: 0, y: 2, tile: 'Red', layer: 'changeTile'},
|
{x: 0, y: 2, tile: 'Red', layer: 'changeTile'},
|
||||||
@ -19,6 +23,9 @@
|
|||||||
{x: 8, y: 4, tile: 109, layer: 'changeTile'},
|
{x: 8, y: 4, tile: 109, layer: 'changeTile'},
|
||||||
{x: 9, y: 4, tile: 'blue', layer: 'changeTile'}
|
{x: 9, y: 4, tile: 'blue', layer: 'changeTile'}
|
||||||
]);
|
]);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user