Home > Article > Web Front-end > The html noscript tag is an important tag that has been overlooked
Open the new backend of Drupal and find that a large area of blank space is displayed
. I thought it was a CSS problem, but after struggling for a long time, I found out that I had disabled the Javascript in the browser due to security issues on some sites. The increasing power of Javascript makes our web pages richer and more colorful, the interactions more and more powerful, and the functions more and more dazzling. However, some web page effects are completely dependent on Javascript. Once without the support of Javascript, even the basic content may not be fully displayed. At this time, our old and strong noscript tag should come out.
The noscript tag is a A fairly old tag that was originally introduced to help smooth the upgrade of older browsers because early browsers did not support JavaScript. The noscript tag displays alternative content in browsers that do not support JavaScript. This element can contain any HTML element. The usage of this tag is also very simple:
<noscript> <p>本页面需要浏览器支持(启用)JavaScript</p></noscript>
However, by now, browsers that do not support Javascript should no longer appear, but users may also have disabled Javascript for various reasons. Such as saving traffic, extending battery life, or not wanting your privacy to be leaked by various statistics/tracking scripts
. There are also quite a few users who have installed browser extensions similar to NoScript to prevent the browser from running Javascript. Although the website cannot force users to enable Javascript in their browsers, it can prompt users that their browsers have disabled scripts to achieve a better user experience. For example, Fackbook prompts like this:
The content in the elements in the noscript tag will only be displayed under the following circumstances:
The browser does not support scripts
The browser supports scripts, but scripts are disabled
If any of the above conditions are met, the browser will display the content in noscript. In other cases, the browser will not render the content in noscript.
Written at the endUsing the noscript tag can only convey a message to website users, that is, if Javascript is not enabled, the content and effects of the web page may not be fully rendered. But if some users don't know how to turn on Javascript, such prompt information will not be of any practical help to them. Therefore, we should still consider how to make such unconventional situations affect the user's browsing as little as possible without the support of Javascript (or
HTML5, or other dependencies) at the beginning of the website design. experience.
The above is the detailed content of The html noscript tag is an important tag that has been overlooked. For more information, please follow other related articles on the PHP Chinese website!