Announcement

Collapse
No announcement yet.

looking for template code to detect browser being used

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    looking for template code to detect browser being used

    chatgpt suggested this:

    <mvt:assign name="user_agent" value="l.settings:user_agent" />
    <mvt:if expr="INSTR(user_agent, 'Edg')">
    <p>You are using Microsoft Edge.</p> <mvt:elseif expr="INSTR(user_agent, 'Chrome')">
    <p>You are using Google Chrome.</p> <mvt:elseif expr="INSTR(user_agent, 'Firefox')">
    <p>You are using Mozilla Firefox.</p> <mvt:elseif expr="INSTR(user_agent, 'Safari')">
    <p>You are using Safari.</p> <mvt:else>
    <p>Browser not identified.</p> </mvt:if>

    Miva template compiler flags INSTR as invalid.

    Looking for template code that will work.
    Thanks,
    Larry
    Larry
    Luce Kanun Web Design
    www.facebook.com/wajake41
    www.plus.google.com/116415026668025242914/posts?hl=en



    #2
    Try our coding bot here: https://docs.miva.com/developer/

    It's different than the one on the rest of the pages.
    Thanks,

    Rick Wilson
    CEO
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      wajake41 That value is a system variable called s.http_user_agent You can use <mvt:eval expr="s.http_user_agent" /> to render the value.

      Nicholas Adkins
      Technical Training Specialist / Miva, Inc.
      [email protected]
      https://www.miva.com/mivalearn

      Comment

      Working...
      X