Detect the internet browser

Monkey Targets Forums/HTML5/Detect the internet browser

pit(Posted 2015) [#1]
Hi all,

Is there a method in order to detect on which internet browser (IE, Safari etc) an app is running ?

Thanks

Pit


dawlane(Posted 2015) [#2]
See the audio test sample from Mark (mak). It shows you how to use the navigator.userAgent to get some information.
The link below should give you some idea on how to use it.
http://www.javascriptkit.com/javatutors/navigator.shtml


pit(Posted 2015) [#3]
Thanks dawlane.

But the code is in javascript.
No monkey code in order to do it ?

cheers

Pit


dawlane(Posted 2015) [#4]
UserAgent should also be accessible in the dom module in the navigator member. The link should give you some idea on what you should be searching for in a userAgent string.

Edit: Some code
Strict
Import mojo
Import dom


Class CGame Extends App
	Method OnCreate:Int()
		Print window.navigator.userAgent
		Return 0
	End
	Method OnUpdate:Int()
		Return 0
	End
	Method OnRender:Int()
		Return 0
	End
End

Function Main:Int()
	New CGame()
	Return 0
End



pit(Posted 2015) [#5]
ok thanks

but then my question is "how to access the dom module from monkey ?"
is there a method or a function able to do that ?

Pit


dawlane(Posted 2015) [#6]
See edited post above with code. It's part of the dom window class.


dawlane(Posted 2015) [#7]
One more thing you will not find dom in the documentation. Why I don't know. But it may be because it's only for HTML, but for reference see the w3schools.com website and the dom module for comparison.


pit(Posted 2015) [#8]
thanks dawlane.
in fact, it was my next question: "I don't find any dom module ?" :-)
so i will try yur solution !

thanks again !

Pit