Browser Detection (Mobile/MSIE)

Browser Detection (Mobile/MSIE) 1.3.3

No permission to download

MOZ

Well-known member
#21
For anyone with any doubts, this addon provides a tool to detect which browser the user is using. By itself it doesn't display anything (Regarding the user browser) or perform any action.

You can use the variables mentioned in the addon description to perform actions based on the user browser both in your templates and PHP files. These variables may be used in any template/PHP file, and enclose any block of code in conditionals . These variables aren't available in the stock XenForo.

I hope this makes it clearer for everyone else.
 

DFI

Active member
#22
I had installed, used and done template editing in more than 50 addons but this one is completely out of my mind. :mad:

I am very keen to use this functionality but due to unclear and complicated instructions, I am unable to get this functionality.

It would be great if Developer provide an example of Template and PHP edit. Please make it little bit more interactive for noobz like us.

Thanks !
 

cclaerhout

Well-known member
#23
I had installed, used and done template editing in more than 50 addons but this one is completely out of my mind. :mad:

I am very keen to use this functionality but due to unclear and complicated instructions, I am unable to get this functionality.

It would be great if Developer provide an example of Template and PHP edit. Please make it little bit more interactive for noobz like us.

Thanks !
  1. What do you think this addon does?
  2. If you know basic php what do you not understand with the provided example?
PHP:
    $visitor = XenForo_Visitor::getInstance();
    if($visitor->getBrowser['isIE'])
    {
        if($visitor->getBrowser['IEis'] == 9)
        {
            echo "You're using Internet Explorer 9";
        }
        else
        {
            echo "You're using Internet Explorer " . $visitor->getBrowser['IEis'];
        }
    }
    elseif ($visitor->getBrowser['isMobile'])
    {
        $builder = "You're using a mobile device. ";
 
        if($visitor->getBrowser['isTablet'])
        {
            $builder .= "This Mobile device is a tablet";
        }
 
        echo $builder;
    }
    else
    {
        echo "Hello World !";
    }
 

DFI

Active member
#24
You are great bro and your level of knowledge regarding php would be 100000 times higher than us. So, pls don't feel offended.

My queries are :

1. As you said I can copy the Template Edit in any template. So can i copy it in " Extra.css " ?
2. Where will i copy and paste the entire variable ? In between the below code or somewhere else ?

Code:
<xen:if is="{$visitor.getBrowser.isIE}">
        {xen:if "{$visitor.getBrowser.IEis} == 9", "You're using Internet Explorer 9", "You're using Internet Explorer {$visitor.getBrowser.IEis}"}
    <xen:elseif is="{$visitor.getBrowser.isMobile}" />
        You're using a mobile device.{xen:if "{$visitor.getBrowser.isTablet}", "This Mobile device is a tablet"}
    <xen:else />
        Hello world !
    </xen:if>
3. I have never done PHP editing. So, please guide where to post the PHP example and variable.
 

cclaerhout

Well-known member
#25
If you have never done php editing before, I really don't see any reasons for you to start to do some with that developing tool. Now about php, if you never read a beginner tutorial with php, yes my "knowledge" about php is higher than yours. Now if you did, and I repeat the elementary one (conditional&loops&string&array), you will have approximately the same "knowledge" than mine. But you're not going to start to write or modify a php code if you never read before some tutorials. It would be the same that to want to write Japanese whereas you never took some classes or never opened a beginner book.

Now about templates, you use these conditionals in the XenForo css templates, but of course the code inside them must be css... so the previous example will of course not work. I will also advice you not to use these conditionals inside the css templates but to use them on normal templates with different links to css templates per browser/device/etc.
Example:
HTML:
<xen:if is="{$visitor.getBrowser.IEis} < 9">
<xen:require css="myIeCssTempale.css" />
<xen:else />
<xen:require css="myNormalTemplate.css" />
</xen:if>
If you don't know what is a css template or a "normal" template, you will need to search info on this forum. The above code can be inserted in any of your customized template. You will need to create two others css templates myIeCssTempale.css for IE6-7-8 and another myNormalTemplate.css for normal css.


If you don't understand the code above, I'm sorry but this addon is a developing tool. It can be used with other addons (read the posts of that threads) or with your own creation/style. If you're expecting this addon to give information to users about which browser is using your members, check instead this addon.



I will not reply anymore to any questions on how to use this addon, since I don't see any way to explain better what others and I already did in that thread.
 
#26
Because you aren't telling us in WHAT TEMPLATES TO PLACE IT AND EXACTLY WHERE. Most people, when releasing an add on, tell you exactly what edits to make and where to make them. You are obviously assuming that each of us are experienced as you are and just know automatically where to put them. It's a simple question that's been asked many times and there is a simple answer. You just aren't giving it to us.
 

cclaerhout

Well-known member
#27
Because you aren't telling us in WHAT TEMPLATES TO PLACE IT AND EXACTLY WHERE. Most people, when releasing an add on, tell you exactly what edits to make and where to make them. You are obviously assuming that each of us are experienced as you are and just know automatically where to put them. It's a simple question that's been asked many times and there is a simple answer. You just aren't giving it to us.
I've already replied you. This developing tools works in all templates. It's obvious you're mistaken about this addon purpose. That's why I'm asking again: what do you think this addon does?
 

cclaerhout

Well-known member
#30
Because THIS add on- Mobile Agent Tracer says in order for me to tell a person is using a certain device, that I have to have this.
The Mobile Agent Tracer only gives you the instruction to install the Browser Detection addon, nothing more. Once the Browser Detection addon installed, you don't need to touch anything.
 

Mouth

Well-known member
#31
I installed this add-on, and then Mobile Tracer. In less than 24 hrs, my users were saying it is highly incorrect. Couple of examples ...


its also sometimes wrong , some of my posts say ipad when
its a galaxy s 3.
not that it matters though , just saying.

And in at least this case it's just plain wrong wrong.
I sent that from my PC (I don't even have a mobile internet device).

I have "Change Agent Tracer Information when message is edited?". Could it be that a 'like' is causing an 'edit' that updates the mobile trace with the 'like'rs device?
 

cclaerhout

Well-known member
#32
I installed this add-on, and then Mobile Tracer. In less than 24 hrs, my users were saying it is highly incorrect. Couple of examples ...

I have "Change Agent Tracer Information when message is edited?". Could it be that a 'like' is causing an 'edit' that updates the mobile trace with the 'like'rs device?
I've never had this problem before. What these users can do is checking this website: http://demo.mobiledetect.net to see if the return results are correct.
 

cclaerhout

Well-known member
#34
I have "Change Agent Tracer Information when message is edited?". Could it be that a 'like' is causing an 'edit' that updates the mobile trace with the 'like'rs device?
Next time I will read the full question, the answer is yes. Well done. I will look how to fix this in the next version of the Agent Tracer (this week). Until now, please uncheck this option to change information when message edited. Oh, this conversation should be continued in the proper thread. Thanks.
 

Dynamic

Well-known member
#36
Hey guys,

I am just wondering. If a user is on a mobile device (any sort of device), can I get it to display one thing, but if a user is on a computer, get it to display something else? How is this done?

Does this mean all mobile types (tablet, phone, etc)?
visitor.getBrowser.isMobile
 

cclaerhout

Well-known member
#37
Hey guys,

I am just wondering. If a user is on a mobile device (any sort of device), can I get it to display one thing, but if a user is on a computer, get it to display something else? How is this done?

Does this mean all mobile types (tablet, phone, etc)?
visitor.getBrowser.isMobile
Yes:
HTML:
    <xen:if is="{$visitor.getBrowser.isMobile}">
        You're using a mobile device. {xen:if "{$visitor.getBrowser.isTablet}", "This Mobile device is a tablet"}
    <xen:else />
        You're not using any mobile devices.
    </xen:if>
 

Dynamic

Well-known member
#38
Yes:
HTML:
    <xen:if is="{$visitor.getBrowser.isMobile}">
        You're using a mobile device. {xen:if "{$visitor.getBrowser.isTablet}", "This Mobile device is a tablet"}
    <xen:else />
        You're not using any mobile devices.
    </xen:if>

Ah thanks for that. So will something like this work...


HTML:
    <xen:if is="{$visitor.getBrowser.isMobile}">
        This will display to all mobile users (phones, tablets, etc)
    <xen:else />
        This will display to all computer screens.
    </xen:if>
 

cclaerhout

Well-known member
#39
Ah thanks for that. So will something like this work...


HTML:
    <xen:if is="{$visitor.getBrowser.isMobile}">
        This will display to all mobile users (phones, tablets, etc)
    <xen:else />
        This will display to all computer screens.
    </xen:if>
Providing the user doesn't spoof/fake his browser agent, yes.
 
Top