rajeshkumar
rajeshkumar

Reputation: 39

In mediawiki, Add noscript tag to enable script

I am doing site in mediawiki, I have used so many javascript, so if the javascript is enable only i can able to see the mediawiki pages. And i am using the skins as vector. I need to know how to add the noscript tag in header in mediawiki for display the error if javascript is disabled . Kindly suggest any solution

Upvotes: 0

Views: 244

Answers (1)

leo
leo

Reputation: 8520

Two approaches:

  1. Rather that alter the skin (and loose your changes on the next update), you could write a simple extensions that does what you want. That will be more future-proof, and also work no matter what skin the user has in their user preferences.

    There are a number of hooks your could use. to get the noscript-message to appear below the title, you could use the SkinSubPageSubtitle hook. The extension would then look somthing like this:

    $wgHooks['SkinSubPageSubtitle'][] = 'fnAddNoScript';
    
    function fnAddNoScript(&$subpages,$skin) { 
    
        $subpages .= Html::element('noscript',null, $yourMessage );
    
        return true; 
    }
    
  2. MediaWiki adds the class client-nojs to the <html> tag when rendering a page, and replaces it with client-nojs with JavaScript, so that it will only be left for clients woth no JS. Hence, yuo can easily style a text to show up only for those clients:

    <div class="nojs">Message</div>
    

And in your css:

    .client-js .nojs {display:none;}

Upvotes: 1

Related Questions