• I would like to hide some of the meta tags from using browsers’ “view source” feature, but still allowing robots/crawlers to see the tags.

    I had tried this code, but could not get it to work:

    <head>
    <!--#if expr="\"$HTTP_USER_AGENT\" != /Mozilla|MSIE|Opera|Lynx|WebTV|NCSA Mosaic/" -->
    <meta name="keywords" content="<?php bloginfo('description'); ?>" />
    <?php wp_head(); ?>
    <!--#endif -->
    </head>

    Could you advise if there is a proper way to do this?

    thx!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ecchisan

    (@ecchisan)

    Another way I have come across which is similarly:

    <!--#set var="Agent" value="${HTTP_USER_AGENT}" -->
    <!--#if expr="$Agent = /en/" -->
    <!--#elif expr="$Agent = /MSIE/" -->
    <!--#elif expr="$Agent = /Opera/" -->
    <!--#elif expr="$Agent = /Netscape/" -->
    <!--#else -->
    <meta name="Description" content="Type your description here">
    <meta name="Keywords" content="add, your keywords, here">
    <!--#endif -->

    But it did not work either.

    Hope you can help…. thx in advance

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Aren’t those supposed to have one -?

    <!–#else –> instead of <!–-#else -–>?

    I may be hungover.

    Thread Starter ecchisan

    (@ecchisan)

    hi, Ipstenu, same here… I have not been sober since Wednesday (or, since I turned 19 )

    Aren’t those supposed to have one -?

    <!–#else –> instead of <!–-#else -–>?

    yes, that was a mistake.

    But after changing all the double dashes to single, it still did not work. Can you advise before heading out to the pub this weekend? Happy New Year!!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Sorry, I’ve had bad luck with if/else’s like that (trying to give IE it’s own css) so I tend to ignore it.

    Thread Starter ecchisan

    (@ecchisan)

    Maybe I should use a php approach instead….. I will try something now, if I get anything I will post it here!!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Hide certain meta tag from browser “view source” using $HTTP_USER_AGENT’ is closed to new replies.