Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#21 2011-10-28 09:21:50
- hallstu
- Member
- From: UK
- Registered: 2006-04-18
- Posts: 16
Re: adi_mobile - Mobile browser detection
So when you connect to your website using the Android HTC Desire HD, it’s telling us it’s a Mac running Snow Leopard? Do what?
Yup, seems that way. I don’t understand either, I just browse to the thing! I’ll check some Android forums, seems too weird.
Thanks
Offline
#22 2011-12-26 16:26:04
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: adi_mobile - Mobile browser detection
Hi Adi
First of all, congratulations for this fantastic plugin. I want to start to use it. My doubt is the next:
Testing & Diagnostics Tags don´t work in my sites as in your test page. What do I do wrong ? I must include jQuery in my <head> section ?
Thanks
Fernando
Offline
#23 2011-12-28 20:59:30
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,300
- Website
Re: adi_mobile - Mobile browser detection
gfdesign wrote:
I must include jQuery in my <head> section ?
Hi Fernando. jQuery is only required for viewport dimension/orientation detection. For basic mobile detection – make sure that you’ve got <txp:adi_mobile />
at the top of your page template. You can use <txp:variable name="adi_mobile_useragent" />
to see what it picks up. The <txp:adi_if_mobile />
conditional will then function based on that.
Offline
#24 2011-12-28 21:28:43
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: adi_mobile - Mobile browser detection
Thanks Adi
Please, check my template if I´m doing some wrong
<txp:adi_mobile />
<html>
<head><title>Test Movil</title></head>
<body>
<txp:variable name="adi_mobile_useragent" /> <!-- does work -->
<br />
<txp:variable name="adi_mobile_viewport" /> <!-- doesn´t work, It gives me: ?,?,? -->
<br />
<txp:variable name="adi_mobile_orientation" /> <!-- doesn´t work, It gives me: ? (0) -->
</body>
</html>
Offline
#25 2011-12-28 22:17:18
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,300
- Website
Re: adi_mobile - Mobile browser detection
Then you’d have something like:
<txp:adi_if_mobile>
<p>mobile content here</p>
<txp:else />
<p>desktop content here</p>
</txp:adi_if_mobile>
and you’ll need jQuery on the page for the viewport stuff.
Offline
#26 2011-12-29 11:40:06
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: adi_mobile - Mobile browser detection
Hello Adi. I´m sorry to have to ask you again.
Regrettably, tags Testing & Diagnostics don´t work for me.
Check my code. Could be a hosting problem ?
<txp:adi_mobile />
<html>
<head><title>Test Movil</title>
<script type="text/javascript" src="textpattern/jquery.js"></script>
</head>
<body>
<txp:adi_if_mobile>
<p>mobile content here</p>
<txp:adi_if_mobile orientation="v">
- the mobile is being held vertically (portrait mode) <!-- always I see this text, doesn't matter the orientation of my mobile phone -->
</txp:adi_if_mobile>
<txp:adi_if_mobile orientation="h">
- the mobile is being held horizontally (landscape mode) <!-- never I see this text, doesn't matter the orientation of my mobile phone -->
</txp:adi_if_mobile>
<txp:else />
<p>desktop content here</p>
</txp:adi_if_mobile>
<hr />
<txp:variable name="adi_mobile_useragent" /> <!-- this tag works correctly -->
<hr />
<txp:variable name="adi_mobile_viewport" /> <!-- doesn´t work, It displays: ?,?,? -->
<hr />
<txp:variable name="adi_mobile_orientation" /> <!-- doesn´t work, It displays: ? (0) -->
</body>
</html>
Note: My mobile phone is Samsung Galaxy S2
Offline
#27 2011-12-29 12:22:30
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,300
- Website
Re: adi_mobile - Mobile browser detection
gfdesign wrote:
Hello Adi. I´m sorry to have to ask you again. Regrettably, tags Testing & Diagnostics don´t work for me. Check my code. Could be a hosting problem ?
The code’s fine – it picks up my iPhone OK.
Note: My mobile phone is Samsung Galaxy S2
Smells like the mobile detection code is not picking up your phone properly. If you give me your user agent string, I’ll check it out.
Offline
#28 2011-12-29 13:00:47
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: adi_mobile - Mobile browser detection
User Agent provides:
Mozilla/5.0 (Linux; U; Android 2.3.4; es-us; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
The strange is when I browse your page test it works well in my mobile phone. I pretend the same in my site :-)
If you have no ideas, don´t worry. With what the can I do with your plugin, it serves me.
Regards.
Offline
#29 2012-01-18 19:39:13
- geoff777
- Plugin Author
- From: Benarrabá Andalucía Spain
- Registered: 2008-02-19
- Posts: 282
- Website
Re: adi_mobile - Mobile browser detection
Hi Adi,
first a big thanks for the plugin.
Can I check on narrow, wide & medium without calling on JS?
If not what is the minimum?
JQuery + <txp:adi_mobile_script />
Also:-
Can you tell me what <txp:adi_mobile_script /> does or calls?
Thanks
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
#30 2012-01-18 20:32:58
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,300
- Website
Re: adi_mobile - Mobile browser detection
geoff777 wrote:
Can I check on narrow, wide & medium without calling on JS?
Unfortunately not.
If not what is the minimum? JQuery + <txp:adi_mobile_script />
Yes.
Can you tell me what <txp:adi_mobile_script /> does or calls?
This is the bit that detects the dimensions & orientation. It refreshes the page & the results are stored in a cookie for later use.
Offline