Welcome guest, please Login or Register

EEC.MS - ExpressionEngine add-ons

You are here: HomeForum Home → Free add-ons → Plugins → Thread

   

MX Mobile Device Detect Allowing users to go view full site after being redirected?

Rank

Total Posts: 4

Joined 2011-07-19

PM

I’m trying to accomplish the full website option after being redirected to the mobile version using your suggested code but it is not working.

Using the code I pasted below, ALL browsers get redirected to the mobile version - even desktop browsers.  Help!

{if segment_1 == "fullsite"}
 {exp
:mobile_detect enable="off"  location="http://www.site.com"}
{if
:else}
 {exp
:mobile_detect parse="inward"}
 {if mobile}  
  {exp
:mobile_detect enable="on" location="http://m.site.com"}
 {
/if}
 {
/exp:mobile_detect} 
{
/if} 
     
Avatar
RankRankRankRank

Total Posts: 701

Joined 2010-07-13

PM

{if:else} - Advanced Conditionals

Note: Advanced Conditionals are evaluated after all EE tags are parsed.

could you please try:

{if segment_1 == "fullsite"}
 {exp
:mobile_detect enable="off"  location="http://www.site.com"}
{
/if} 

{if segment_1 
!= "fullsite"}
 {exp
:mobile_detect parse="inward"}
 {if mobile}  
  {exp
:mobile_detect enable="on" location="http://m.site.com"}
 {
/if}
 {
/exp:mobile_detect} 
{
/if} 
     
Rank

Total Posts: 4

Joined 2011-07-19

PM

That worked except for one thing: enable=“on”.  It didn’t work until I removed that part.  For some reason, regardless of the conditionals, enable=“on” is always taking effect if left in there.

Once that was removed it worked like a charm:

{if segment_1 == "fullsite"}
 {exp
:mobile_detect enable="off"  location="http://www.site.com"}
{
/if} 

{if segment_1 
!= "fullsite"}
 {exp
:mobile_detect parse="inward"}
 {if mobile}  
  {exp
:mobile_detect location="http://m.site.com"}
 {
/if}
 {
/exp:mobile_detect} 
{
/if} 
     
Avatar
RankRankRankRank

Total Posts: 701

Joined 2010-07-13

PM

possible its because correct parameter is

enable="yes" 

I will add option “on”(for using both variants) to next version.

     
Rank

Total Posts: 4

Joined 2011-07-19

PM

All of a sudden this code caused iphones and ipads not to redirect.  =/

     
Rank

Total Posts: 4

Joined 2011-07-19

PM

Nevermind - I was using an iphone simulator.  The actual iphone redirected successfully.  Disregard my last post.

     
Rank

Total Posts: 11

Joined 2011-07-11

PM

I am using this code and when I click the “Go to main website” link, it still goes to the mobile site. Anything wrong with my code?

{if segment_1 == "http://www.dermatologyconsultants.com"}
 {exp
:mobile_detect enable="no" location="http://www.dermatologyconsultants.com"}
{
/if} 

{if segment_1 
!= "http://www.dermatologyconsultants.com"}
 {exp
:mobile_detect parse="inward"}
 {if mobile}  
  {exp
:mobile_detect enable="yes" location="http://www.dermatologyconsultants.com/index.php/mobile" ipad="no"}
 {
/if}
 {
/exp:mobile_detect} 
{
/if} 

Thanks!
Amy

     
Rank

Total Posts: 11

Joined 2011-07-11

PM

We figured it out. This is the code that works for us:

{if segment_1 == 'fullsite'}
 {exp
:mobile_detect enable='off' location='http://www.dermatologyconsultants.com'}
{
/if}
 
 {if segment_1 
!= "fullsite"}
 {exp
:mobile_detect location="http://www.dermatologyconsultants.com/index.php/mobile" ipad="no" redirect="mobile"}
{
/if} 

 

     
Avatar
RankRankRankRank

Total Posts: 701

Joined 2010-07-13

PM

yea, possible something with parsing order. You solutions is right, except one - if person who choose full site, will want to switch to mobile again, you will need something like

{if segment_1 == 'mobile'}
 {exp
:mobile_detect enable='on' location='http://www.dermatologyconsultants.com'}
{
/if} 

btw - you can control enable / disable with JS - I will do examples when I will have a free time…

     
Rank

Total Posts: 5

Joined 2011-12-14

PM

I’m using the following code:

{if segment_1 == “fullsite”}
{exp:mobile_detect enable=“off” location=“http://www.richmondhillvisit.com”}
{/if}

{if segment_1 != “fullsite”}
{exp:mobile_detect parse=“inward”}
{if mobile}
  {exp:mobile_detect enable=“yes” location=“http://www.richmondhillvisit.com/index.php/mobile”}
{/if}
{/exp:mobile_detect}
{/if}

It’s redirecting mobile devices that I’ve tested.

However, IE7 is being redirected as well. Firefox and Safari aren’t. I haven’t tested IE8.

Thoughts?

     
Rank

Total Posts: 5

Joined 2011-12-14

PM

Here’s the user agent information being returned:

Mozilla/4.0 (compatible; MSIE
7.0; Windows NT 5.1; .NET CLR
2.0.50727; .NET CLR
3.0.4506.2152; .NET CLR
3.5.30729; InfoPath.2)

     
Avatar
RankRankRankRank

Total Posts: 701

Joined 2010-07-13

PM

do you use last version(2.8)?

     
Rank

Total Posts: 5

Joined 2011-12-14

PM

Yes, I modified it to this and it worked correctly:


{if segment_1 == “fullsite”}
{exp:mobile_detect enable=“off” location=“http://www.richmondhillvisit.com”}
{/if}

{if segment_1 != “fullsite”}
{exp:mobile_detect parse=“inward”}
{if mobile}
  {exp:mobile_detect location=“http://www.richmondhillvisit.com/index.php/mobile” redirect=“mobile”}
{/if}
{/exp:mobile_detect}
{/if}

The enable, maybe? Something else?

     
Avatar
RankRankRankRank

Total Posts: 701

Joined 2010-07-13

PM

so your last example works correctly with IE7?

     
Rank

Total Posts: 5

Joined 2011-12-14

PM

Yes. And Safari…Safari was redirecting, too, I found later.