Sigurjón Sigurjón - 19 days ago 5
CSS Question

Hide header/footer when url contains a certain parameter

I have a multi page webpage that has a header and footer on all pages,
and I am creating an app than can view certain areas of the page, but I dont want to show the footer and header when I am browsing through the app.

When I access the page through the app the app adds a parameter to the url. like this:

www.mypage.com?inapp=true


What is the most efficient way to this with java script and css?

Answer
<script>
    $(document).ready(function(){
        var url = window.location.href;
        if(url.search('inapp=true') === true){
            $('header').css('display', 'none');
        }
    });
</script>
Comments