You are here: Home → Forum Home → Free add-ons → Plugins → Thread
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}
{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}
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}
possible its because correct parameter is
enable="yes"
I will add option “on”(for using both variants) to next version.
All of a sudden this code caused iphones and ipads not to redirect. =/
Nevermind - I was using an iphone simulator. The actual iphone redirected successfully. Disregard my last post.
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
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}
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…
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?
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)
do you use last version(2.8)?
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?
so your last example works correctly with IE7?
Yes. And Safari…Safari was redirecting, too, I found later.