Browser Detection - Activation/Deactivation?

Discussion and feedback on Construct 2

Post » Tue Dec 25, 2012 6:47 pm

I was wondering; is there a way in C2 to make your HTML5 game detect what browser the user is playing your game on, and then only allow the game to play if the browser is correct? For example:

Person is playing the Wii U with the Wii U's browser. Person goes to play your game. The game detects that the user is using the Wii U browser and the game boots.

Another person attempts to access your game from another browser... the game automatically disables because it recognizes that it's not the Wii U browser and won't allow access.

Thoughts?
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Tue Dec 25, 2012 7:06 pm

The browser object can detect the browser name already. However it is not recommended to make games for the wii U's browser, which features extremely limited HTML5 capability.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Tue Dec 25, 2012 7:20 pm

The app I was thinking of doing wouldn't require sound or character animation, so I'd probably be able to skate around the current issues with the Wii U and HTML5 games.

Any idea on how to make a C2 program detect a specific browser? I'm not well-versed in C2 yet, I'm looking at the demo. I see the Browser object, but I don't see any detection actions. Perhaps I'm missing something?MrMiller2012-12-25 19:45:31
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Wed Dec 26, 2012 12:27 pm

You can use the user agent string from the Browser object, but this is *not recommended*. You should never block people entirely, just give them a choice - otherwise if your detection is buggy you'll be blocking people who could have legitimately played the game. Also note most browsers can fake their user agent string for compatibility reasons, so it's not a very reliable thing to work with in the first place.Ashley2012-12-26 12:27:42
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Dec 26, 2012 5:43 pm

^Ah, gotcha. Works well. Thanks, Ashley!
B
12
S
4
G
3
Posts: 426
Reputation: 2,458


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests