Class Noscript


@Bean(typeName="noscript") public class Noscript extends HtmlElementMixed
DTO for an HTML <noscript> element.

The noscript element represents nothing if scripting is enabled, and represents its children if scripting is disabled. It is used to provide alternative content for users who have JavaScript disabled or when JavaScript is not available. The noscript element can contain any flow content and is typically used to display a message or alternative functionality when JavaScript cannot be executed. It is commonly placed in the head or body of a document.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple noscript message Noscript simple = noscript("Please enable JavaScript to use this application."); // Noscript with styling Noscript styled = noscript("JavaScript is required for this page to function properly.") ._class("noscript-message"); // Noscript with complex content Noscript complex = noscript( h2("JavaScript Required"), p("This application requires JavaScript to function."), p("Please enable JavaScript in your browser and refresh the page.") ); // Noscript with ID Noscript withId = noscript("JavaScript is disabled.") .id("noscript-message"); // Noscript with styling Noscript styled2 = noscript("JavaScript is required for this page.") .style("background-color: #f8d7da; color: #721c24; padding: 10px; border: 1px solid #f5c6cb;"); // Noscript with multiple elements Noscript multiple = noscript( h3("JavaScript Disabled"), p("This page requires JavaScript to function properly."), p("Please enable JavaScript and refresh the page."), a("/help/javascript", "Learn how to enable JavaScript") ); // Noscript with form Noscript withForm = noscript( p("JavaScript is disabled. Please use the form below:"), form().action("/submit").method("post").children( input("text").name("name").placeholder("Name"), input("submit").value("Submit") ) );

See Also: