Hide/unhide div based on URL

3 replies
Hi All,

I hope someone in here can help me out because I am a bit confused right now! I have searched everywhere for solutions on this issue but cant find anything...

The question:

I would like to show a specific "div" when and only when visitors are on the root domain etc. test.com/index.php

If visitors are on any other url the "div" should be hidden. (Including test.com/index.php"?something-extra-here")

How can this be achieved in PHP/JavaScript?

Any ideas? Any help is appreciated

Thanks in advance!
#based #div #hide or unhide #hide/unhide div #url
  • Profile picture of the author SteveJohnson
    Check the PHP $_SERVER['REQUEST_URI'] and $_SERVER['QUERY_STRING'] superglobals.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[2523992].message }}
  • Profile picture of the author John Webster
    Thanks that helped me in the right direction :-)
    {{ DiscussionBoard.errors[2526538].message }}
  • Profile picture of the author zeeshi570
    Yes you can use query string to hide or show any div.
    or use document.href in javascript
    {{ DiscussionBoard.errors[2527456].message }}

Trending Topics