Home Web Front-end H5 Tutorial Share some unpopular knowledge about html5

Share some unpopular knowledge about html5

May 10, 2017 pm 01:54 PM

HTML is the unified language of the Web. These rough tags contained in angle brackets constitute today's Web. In 1991, Tim Berners-Lee wrote a document called "HTML Tags", which includes about 20 HTML tags used to mark web pages. He directly borrowed the markup style of SGML, which is the HTML markup style we saw later.

Today, the editor of Huwu will sort out the html5 cold knowledge that you may not know.

Run the browser address barJavaScriptCode
Many people should still know this. You can run JavaScript code directly in the browser address bar. The method is to start with javascript: followed by execution statement. For example:

Share some unpopular knowledge about html5

## Note that to execute the javascript code, you need to enter it manually in the browser. If you copy the code, IE and

Chr Ome will automatically remove the javascript: at the beginning of the code, so it needs to be added manually for correct execution. Although Firefox will not automatically remove it, it does not support running JS code in the address bar at all! !

Run HTML code in the browser address bar

If more people know the little secret above, fewer people know this tip. In non-IE core browsers The address bar can run HTML code directly!

Anyway, I, the editor of Huwu, only learned about it accidentally recently.

For example, enter the following code in the address bar and press Enter to run. The specified page content will appear.


Share some unpopular knowledge about html5

As shown below:


Share some unpopular knowledge about html5

Treat the browser as

Editor Still making a fuss on the browser address bar, paste the following code into the address bar and run it, and the browser will become a primitive and simple editor, just like the notepad that comes with Windows, roar Roar.

Share some unpopular knowledge about html5

As shown below:


Share some unpopular knowledge about html5

In the final analysis, thanks to HTML5 The newly added contenteditable

attribute, when the element is specified with this attribute, the content of the element becomes editablestate.

By extension, after putting the following code into the console and executing it, the entire page will become editable!


Share some unpopular knowledge about html5

As shown below:


Share some unpopular knowledge about html5
##Use a tag to automatically parse URL

Many times we have the need to extract domain names from a URL,

query
keywords,variablesparameter values, etc., but we never expected that the browser can easily help We accomplish this task without writing regular code to capture it. The method is to first create an a tag in the JS code and then assign the URL that needs to be parsed to the href attribute of a, and then we get everything we want.

Share some unpopular knowledge about html5
As shown below:


Share some unpopular knowledge about html5
Use the above method to Browser parameters to operate!


Share some unpopular knowledge about html5

Elements with IDs on the page will create global variables
In an HTML page, all elements with ID attributes set will create corresponding global variables in the JavaScript execution environment, which means document.getElementById is as redundant as the human appendix. But in actual projects, it’s best to just write it honestly. After all, the chance of things going wrong with regular code is much smaller.

Share some unpopular knowledge about html5

As shown below:

Share some unpopular knowledge about html5

When loading the CDN file, You can omit the HTTP identifier
Nowadays, the popular CDN loads some common JS and CSS files from a dedicated server. For security considerations, some CDN servers use HTTPS to connect, while others use traditional HTTP, in fact, we can ignore this when using it and omit it from the URL.

Share some unpopular knowledge about html5

Use the script tag to save any information
Set the script tag to type='text' and then you can save any information in it, and then you can Easily available in JavaScript code.

Share some unpopular knowledge about html5

Of course, there are far more trivia than these.

【Related recommendations】

1. Free h5 online video tutorial

2. HTML5 full version manual

3. php.cn original html5 video tutorial

The above is the detailed content of Share some unpopular knowledge about html5. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles