I’m in the midst of developing a small game for Facebook and would like to setup an HTML file that will serve Chrome users the WebGL version of the game and the Unity Web Player version of the game to all other browsers. In the documentation for the most recent beta version of the Facebook SDK for Unity (v7.0.2), they suggest using something like the following:
<!DOCTYPE html>
<html>
<body>
<script>
var chromeVersion = window.navigator.userAgent.match(/Chrome\/(\d+)\./);
if (chromeVersion && chromeVersion[1]) {
if (parseInt(chromeVersion[1], 10) >= 42) {
window.location = "/games/webGL";
}
}
window.location = "/games/game.html";
</script>
</body>
</html>
Unfortunately, this still loads the “game.html” file in Chrome, which isn’t at all what I had expected. I was hoping someone here might be able to suggest how to properly format the HTML file in order to properly split the two versions between different browsers. If you’ve any suggestions, I’d most certainly appreciate hearing them. Thanks!