Hide/unhide div based on URL

by 3 replies
5
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!
#programming #based #div #hide or unhide #hide/unhide div #url
  • Check the PHP $_SERVER['REQUEST_URI'] and $_SERVER['QUERY_STRING'] superglobals.
    • [ 1 ] Thanks
  • Thanks that helped me in the right direction :-)
  • Yes you can use query string to hide or show any div.
    or use document.href in javascript

Next Topics on Trending Feed