```<html>
<head>
<style>
#gameContainer {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<script src="mraid.js"></script>
<script>
window.addEventListener("message", function (event) {
// Check if the message is from the game frame
if (event.source !== gameFrame.contentWindow) return;
// Handle the game event
if (event.data.type === "gameEvent") {
handleGameEvent(event.data.data);
}
});
function handleGameEvent(eventData) {
console.log("opening store");
mraid.openStoreUrl("https://multiplayer.com.tr");
}
</script>
<div id="gameContainer">
<iframe id="gameFrame" src="https://cdn.multiplayer.com/playable5/index.html"></iframe>
</div>
<script>
var configure = function () {
//configureCss(app._fillMode, app._width, app._height);
// do the first reflow after a timeout because of
// iOS showing a squished iframe sometimes
setTimeout(function () {
const container = document.getElementById("gameContainer");
const gameFrame = document.getElementById("gameFrame");
function setFrameDimensions() {
gameFrame.width = container.offsetWidth;
gameFrame.height = container.offsetHeight;
if (window.mraid) {
var mraidSize = mraid.getMaxSize();
windowWidth = mraidSize.width;
windowHeight = mraidSize.height;
console.log("window is mraid");
}
gameFrame.contentWindow.postMessage({
width: container.offsetWidth,
height: container.offsetHeight
}, "*");
}
setFrameDimensions();
window.addEventListener("resize", setFrameDimensions);
});
};
window.mraid && "ready" !== mraid.getState() ? mraid.addEventListener("ready", configure) : configure();
</script>
</body>
</html>```
4
2
1KB
2KB
196.0ms
170.0ms
258.0ms