Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deal with the influence of web Hollow path on Page performance

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to deal with the impact of web hollow paths on page performance. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

I saw the sharing of Yubo blog on Google Reader a few days ago-the impact of empty paths on page performance. Indeed, when writing CSS, using background:url (#) will make one more request to the page.

However, because writing multiple CSS, generally need to use an empty background to solve the bug, the test results with background:url (about:blank) is what we want: solve the bug, does not affect performance. That's very simple. Won't the solution come out? Wait, let's do a test.

Test the code:

The code is as follows:

Empty src

Body {font-family:courier, 'courier new';} code {background:#f7f7f7;border:1px solid # ddd;padding:0 3px Toun Muzmakit cite cite 2pxTen 2pxFont Mustang 2pxFont Mustang 12pxColorusWan080;} p {color}

1. Send a request:

Browsers: All, some browsers such as chrome, hash (#) and null only request this path

empty image src

The background image uses background:url (#) to send the request

image src using hash(#)

(2) partially send the request:

Browsers (very small latency): safari, chrome (multiple about:blank will send multiple requests)

Use about:blank

empty image src

Hello world

Second, do not send a request:

Browser: all, chrome (invalid delay, equivalent to no request sent)

Use _ javascript:''

empty image src

Don't bother to take screenshots, do it by yourself. The browsing results have been roughly written on the test page. The ultimate solution is:

Boldly use about:blank instead of null, or'#', especially in background-image

It is recommended to use _ javascript: "to solve the problem in img / script / iframe

Thank you for reading! This is the end of the article on "how to deal with the impact of web hollow path on page performance". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report