Site logo

Archived topic

hide div for javascript deactivated browsers.

11 replies · Started by Patricia on March 11, 2022

Viewing posts 1–12 of 12

Hi guys can you please help?

I would like to ask how do I proceed to hide the main content div to browsers that are not using javascript and replace the content with a message saying that this site needs javascript to continue the access (in the main content area div).

Many many thanks for that!

Hi there,

I am really not sure about this, but if need be you can use a Hook Element, to add some <noscript> HTML and styles to the page:

<noscript>
<style>
    #main {
        display: none !important;
    }
</style>
<div>Your no Javascript message here</div>
</noscript>

Use the generate_before_main_content hook

thank you! I will try this and will let you know! Have a great weekend!

You're welcome and you too

Hello David!

This works but I cannot show the warning message. any thoughts? thank you!

Where can I see this ?

I put my message where you indicated

</style>

Your no Javascript message here

</noscript>

But i can just see the blank div without the prase. do you know what I mean? :) thank u!

Sorry I meant a link to a page on the website you added it to

ah ok! I am sending in the private tab :) Merci!

Oh my - what was I thinking lol.
Change the Hook to generate_after_header

The other hook is inside the element that the script is hiding... so it hides itself :)

hahaha no problems!! It is working perfectly now! Thank you!

Have a great weekend!

Patricia.

Glad to hear that!!

This archived topic is closed to new replies.