Hello
First. I think the using of jQuery is the reason you have down votes for http://www.yiiframework.com/extension/noscript/
This is the same solution
[html]
<script type="text/javascript"><!–
document.write(’<!’ + ‘–’);
//–></script>
<noscript>
<div id="js-info">
Javascript is off
</div>
</noscript>
<script type="text/javascript"><!–
document.write(’–’+’>’);
//–></script>
[/html]
Explanation:
If the javascript if OFF, visitor will get message
[html]
<noscript>
<div id="js-info">
Javascript is off
</div>
</noscript>
[/html]
If the javascript if ON, visitor will not get message, because Javascript will write comments around message
[html]
<!–<noscript>
<div id="js-info">
Javascript is off
</div>
</noscript>–>
[/html]
Second. Your CSS file has .noscript { … } rule that not used
And some browsers could not apply rule noscript div#js-info { … }, Opera < 10 for example
protected/extensions/noscript/assets/XNoScriptMessage.css
/*
Document : jgui-noscript
Created on : 07.09.2010, 10:34:42
Author : bk016474
Description:
styling for noscript tag.
*/
div#no-javascript {
display:block;
padding: 10px 20px;
background: #fee;
color: #800;
margin: 0 0 10px 0;
border-top:3px solid #c30;
border-bottom:3px solid #c30;
font-weight:bold;
}
protected/extensions/noscript/XNoScriptMessage.php
<?php
/**
* XNoScriptMessage class file.
*
* @author Stefan Volkmar <volkmar_yii@email.de>
* @version 1.0
* @license BSD
*/
/**
*
* This widget create a message if javascript isn't enabled in the browser
*
* @author Stefan Volkmar <volkmar_yii@email.de>
*/
class XNoScriptMessage extends CWidget
{
/**
* @var mixed the CSS file used for the widget.
* If false, the default CSS file will be used. Otherwise, the specified CSS file
* will be included when using this widget.
*/
public $cssFile=false;
/**
* Initializes the widget.
* This method registers all needed client scripts
*/
public function init()
{
$baseUrl = CHtml::asset(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets');
$cssUrl = ($this->cssFile!==false) ? $this->cssFile : $baseUrl.'/XNoScriptMessage.css';
Yii::app()->getClientScript()->registerCssFile($cssUrl);
echo <<<HTML
<script type="text/javascript"><!--
document.write('<!' + '--');
//--></script>
<noscript>
<div id="no-javascript">
HTML;
}
/**
* Renders the close tag of the element.
*/
public function run()
{
echo <<<HTML
</div>
</noscript>
<script type="text/javascript"><!--
document.write('--'+'>');
//--></script>
HTML;
}
}
Here my version of extension
4797
noscript_1.1.zip