Home  >  Article  >  Web Front-end  >  noscript tag, an important tag that is ignored

noscript tag, an important tag that is ignored

PHPz
PHPzOriginal
2017-03-12 15:38:511399browse

Open the new backend of Drupal and find that a large area of ​​​​blank space is displayednoscript tag, an important tag that is ignored

. 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 tags should come outnoscript tag, an important tag that is ignored

. The

noscript tag is a quite old tag. It was originally introduced to help smooth the upgrade of old 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 scriptsnoscript tag, an important tag that is ignored

. There are also quite a number of 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:

noscript tag, an important tag that is ignored

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 noscript content in. In other cases, the browser will not render the content in noscript.

Written at the end

Using 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 noscript tag, an important tag that is ignored. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:ajax response decodingNext article:ajax response decoding