Just starting out? Need help? Post your questions and find answers here.
DjPoke
Posts: 22 Joined: Sat Dec 19, 2015 5:27 pm
Location: France (Corsica)
Contact:
Post
by DjPoke » Wed Jan 13, 2016 11:04 am
I've found a code to detect mobile web-browsers, but after an adaptation, it doesn't seems to works on SB.
Can you take a look ?
I would like the event to be bind only if i'm not under a mobile, but my var "isMobile" always stay to 0.
Code: Select all
isMobile.i = 0
! if(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) {
! v_isMobile = 1;
! }
If isMobile = 0
BindEvent(#PB_Event_SizeWindow, @SizeWindowHandler())
EndIf
Fred
Site Admin
Posts: 1820 Joined: Mon Feb 24, 2014 10:51 am
Post
by Fred » Wed Jan 13, 2016 2:06 pm
The variable needs to be in full lowercase when used in inline JS: v_ismobile. I strongly suggest to take a look to the generate spiderbasic.js file for a better overview of SB internal, it's easy to follow.
DjPoke
Posts: 22 Joined: Sat Dec 19, 2015 5:27 pm
Location: France (Corsica)
Contact:
Post
by DjPoke » Wed Jan 13, 2016 7:51 pm
Thanks a lot !
I'm sorry, i make novice errors.