Page Speed Optimization Libraries  1.11.33.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
net_instaweb::SupportNoscriptFilter Class Reference

#include "support_noscript_filter.h"

Inheritance diagram for net_instaweb::SupportNoscriptFilter:

Public Member Functions

 SupportNoscriptFilter (RewriteDriver *rewrite_driver)
 
virtual void DetermineEnabled (GoogleString *disabled_reason)
 
virtual void StartElement (HtmlElement *element)
 
virtual const char * Name () const
 
ScriptUsage GetScriptUsage () const override
 

Detailed Description

Inserts a noscript tag as the first element of body. This noscript redirects to "ModPagespeed=off" to prevent breakage when pages rewritten by filters that depend on script execution (such as lazyload_images) are rendered on browsers with script execution disabled.

Member Function Documentation

ScriptUsage net_instaweb::SupportNoscriptFilter::GetScriptUsage ( ) const
inlineoverride

Make sure this filter gets turned off when a document is declared as AMP.

This is a little confusing; SupportNoscript does not itself inject scripts, but it injects http-equiv tags which prevent AMP-HTML from being validated. This filter is a special snowflake that is never enabled by users, but is implied by the initial enabling of other filters that do inject scripts.

Because this filter only changes HTML on behalf of filters that are themselves kWillInjectScripts, [falsely] declaring that this script as kWillInjectScripts has no particular downside.

Todo:
TODO(jmarantz): consider an alterantive mechanism that is more intuitive, and doesn't entail GetScriptUsage lying to induce the right amp behavior.

The documentation for this class was generated from the following file: