Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2011-12-28 22:17:18

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

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,373

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,373

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

#31 2012-01-18 21:08:46

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 282
Website

Re: adi_mobile - Mobile browser detection

Does <txp:adi_mobile_script /> call another script?

Or does it execute jquery?

I’m trying to calculate the server load overhead using this will have.

Last edited by geoff777 (2012-01-18 21:10:24)


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#32 2012-01-18 21:13:52

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_mobile - Mobile browser detection

It’s a small amount of Javascript, which is designed to run only when the orientation changes.

Offline

#33 2012-02-06 01:39:16

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_mobile - Mobile browser detection

Version 0.2 available for download.

  • upgraded Mobile_Detect class (now detects Android Tablet/Blackberry Tablet/Windows Phone)
  • improved tablet detection functionality
  • new adi_mobile attribute ‘useragent’
  • new adi_mobile attribute ‘include’

See the plugin help for tablet examples.

Offline

#34 2012-02-06 11:14:42

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: adi_mobile - Mobile browser detection

Thanks Adi for your nuisance.
Saludos desde Argentina

Last edited by gfdesign (2012-02-06 11:14:57)

Offline

#35 2012-02-06 13:30:01

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 329
Website

Re: adi_mobile - Mobile browser detection

Adi,

Thank you much for this excellent plugin. I used it for the first time last week – enabling different menus to show up for iPad & mobile users (some drop down menus that work fine on desktop/laptop machines didn’t work well on touch devices). Your plugin works beautifully.

Keith

Offline

#36 2012-03-07 15:19:44

hallstu
Member
From: UK
Registered: 2006-04-18
Posts: 16

Re: adi_mobile - Mobile browser detection

hallstu wrote:

bq. 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?

Hi Adi, sorry I completely forgot to reply to this – but just in case you’re interested, turns out HTC (not Android) spoof the user agent by default to appear as a mac, but you can switch this off in the phone settings. No idea why they do this but your plugin works great now.

Thanks again

Offline

Board footer

Powered by FluxBB