Let see first example which is not W3C compatible. We will use PF v7 output handling functions (in second exaple, too). Create new panel, paste below code, save panel, enable it:
?>
add_to_head("<noscript><meta http-equiv='refresh' content='0,URL='js.html' /></noscript>");
<?php
Because this code will redirect us to new page (called js.html), we need to create and upload this too root of our site. From this moment every user which entering our site and hasn't JS enabled in browser will see this page. Example message in this page may look like below:
Sorry, but your browser doesn't support or has not enabled JavaScript. This page require JavaScript. If you're already enabled JavaScript click <a href='index.php'>HERE</a> to go back on main page.
And now example compatible with W3C but which need some theme modyfications. part of (or all of?) DIV based themes in PF v7 contain main DIV:
<div id='container'>[SITE]</div>
If users should have JS enabled then:
1) In styles.css file of your theme modify/add line to #container class:
display:none;
so if your theme not contain #container class add below lines:
#container {
display:none;
}
2) After #container DIV closing tag add next DIV with example text:
<div id='js'>
Sorry, but your browser doesn't support or has not enabled JavaScript. This page require JavaScript. If you're already enabled JavaScript click <a href='index.php'>HERE</a> to go back on main page.
</div>
Next we nedd to create new panel with code:
?>
add_to_head("
<script type='text/javascript'>
$(function(){
$("#js").css("display","none");
$("#container").css("display","block");
});
<script>
");
<?php
When user has no JS enabled then will se above message in other case will se our site content.
Next article soon ;)
PS: thanks to Pieka from Polish PF Support for article formatting.
on Dec 11 2011 at 13:44:05