Unlock instant, AI-driven research and patent intelligence for your innovation.

Browser first rendering time calculation method and device, browser and storage medium

A time calculation and browser technology, applied in computing, program control devices, instruments, etc., can solve the problems of business system impact, low accuracy, low operability, etc., and achieve the effect of high operability

Active Publication Date: 2020-05-08
北京博睿宏远数据科技股份有限公司
View PDF25 Cites 3 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Therefore, the accuracy of the calculation method provided by the existing technology is not high; on the other hand, the embedding point needs to invade the business code, the operability is not high, and there is a certain risk. The intrusion of the business code may cause some unexpected problems, which will affect the business system impact

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Browser first rendering time calculation method and device, browser and storage medium
  • Browser first rendering time calculation method and device, browser and storage medium
  • Browser first rendering time calculation method and device, browser and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0028] figure 1 It is a flow chart of a method for calculating the first rendering time of a browser provided by Embodiment 1 of the present invention. This embodiment is applicable to the approximate calculation of the first rendering time of the browser when the browser does not support the first rendering time interface. The method can be calculated by The calculation device for the first rendering time of the browser is executed, and the device can be implemented by means of software and / or hardware, and the device can be integrated in the processor, such as figure 1 As shown, the method specifically includes:

[0029] Step 110, obtaining all linked external style file tags and all immediately synchronously executed external script tags in the container tag of the head element.

[0030] Wherein, in an implementation of the embodiment of the present invention, optionally, all linked external style file tags and script tags in the head element container tag are obtained by ...

Embodiment 2

[0045]图2是本发明实施例二提供一种浏览器首次渲染时间计算方法的流程图,本实施例是对上述技术方案的进行进一步细化,本实施例可以与上述一个或者多个实施例中的各个可选方案结合。

[0046]如图2所示,该方法具体包括:

[0047]步骤210、当浏览器不是谷歌浏览器和IE浏览器时,获取头部元素容器标签内的所有链接外部样式文件标签和所有立即同步执行外部脚本标签。

[0048]其中,当浏览器是高版本谷歌(Chrome)浏览器时,可以调用支持的首次渲染时间接口,如performance.getEntriesByType(‘paint’)[0].startTime接口获取高版本Chrome浏览器的首次渲染时间。当浏览器是低版本Chrome浏览器时,可以调用支持的首次渲染时间接口,如chrome.loadTimes().firstPaintTime接口获取低版本Chrome浏览器的首次渲染时间。当浏览器是IE(Internet Explorer)浏览器时,可以调用支持的首次渲染时间接口,如performance.timing.msFirstPaint接口获取IE浏览器的首次渲染时间。当浏览器不是Chrome浏览器和IE浏览器时,可以通过本发明实施例提供的浏览器首次渲染时间计算方法进行近似计算。

[0049]可选的,通过指定选择器组的元素列表接口,获取头部元素容器标签内的所有链接外部样式文件标签和脚本标签;将头部元素容器标签内的延迟执行外部脚本标签、异步执行外部脚本标签和内联脚本标签进行过滤,得到所有外部样式文件标签和所有立即同步执行外部脚本标签。

[0050]步骤220、获取所有链接外部样式文件标签和所有立即同步执行外部脚本标签的性能数据。

[0051]可选的,通过指定名称资源性能数据接口,获取所有链接外部样式文件标签和所有立即同步执行外部脚本标签的性能数据。

[0052]步骤230、从性能数据中分别确定各个链接外部样式文件标签和各个立即同步执行外部脚本标签的加载时间,分别作为资源加载时间。

[0053]步骤240、判断文档对象模型DOM开始解析时间是否大于0。

[0054]步骤250、若是,确定DOM开始解析时间为过滤区间的第一端点值;否则,确定页面返回时间为过滤区间的第一端点值。

[0055]步骤260、确定DOM就绪时间为过滤区间的第二端点值。

[0056]步骤270、判断页面开始时间...

Embodiment 3

[0064]图4是本发明实施例三提供的一种浏览器首次渲染时间计算装置的结构示意图。结合图4,该装置包括:标签获取模块310,性能数据获取模块320,资源加载时间确定模块330和浏览器首次渲染时间确定模块340。

[0065]其中,标签获取模块310,用于获取头部元素容器标签内的所有链接外部样式文件标签和所有立即同步执行外部脚本标签;

[0066]性能数据获取模块320,用于获取所有链接外部样式文件标签和所有立即同步执行外部脚本标签的性能数据;

[0067]资源加载时间确定模块330,用于从性能数据中分别确定各个链接外部样式文件标签和各个立即同步执行外部脚本标签的加载时间,分别作为资源加载时间;

[0068]浏览器首次渲染时间确定模块340,用于将资源加载时间中的最大值作为浏览器首次渲染时间。

[0069]可选的,标签获取模块310,包括:标签获取单元,用于通过指定选择器组的元素列表接口,获取头部元素容器标签内的所有链接外部样式文件标签和所有脚本标签;标签过滤单元,用于将头部元素容器标签内的延迟执行外部脚本标签、异步执行外部脚本标签和内联脚本标签进行过滤,得到所有外部样式文件标签和所有立即同步执行外部脚本标签。

[0070]可选的,浏览器首次渲染时间确定模块340,包括:判断单元,用于判断页面开始时间加上各个资源加载时间是否在过滤区间中;浏览器首次渲染时间确定单元,用于若是,将在过滤区间中的资源加载时间中的最大值作为浏览器首次渲染时间;否则,将过滤区间的时间极小值与页面开始时间的差值作为浏览器首次渲染时间。

[0071]可选的,该装置,还包括:判断模块,用于判断文档对象模型DOM开始解析时间是否大于0;第一端点值确定模块,用于若是,确定DOM开始解析时间为过滤区间的第一端点值;否则,确定页面返回时间为过滤区间的第一端点值;第二端点值确定模块,用于确定DOM就绪时间为过滤区间的第二端点值;第一端点值为过滤区间内的时间极小值,第二端点值为过滤区间内的时间极大值。

[0072]可选的,标签获取模块310具体用于当浏览器不是谷歌浏览器和IE浏览器时,获取头部元素容器标签内的所有链接外部样式文件标签和所有立即同步执行外部脚本标签。

[0073]可选的,性能数据获取模块320具体用于通过指定名称资源性能数据接口,获取所有链接外部样式文件标签和所有立即同步执行外部脚本标签的性能数据。

[0074...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The embodiment of the invention discloses a browser first rendering time calculation method and device, a browser and a storage medium. The method comprises the steps of obtaining all link external style file tags and all immediate synchronous execution external script tags in a head element container tag; acquiring performance data of all link external style file tags and all immediate synchronous execution external script tags; respectively determining the loading time of each link external style file label and each immediate synchronous execution external script label from the performance data, wherein the loading time is respectively used as resource loading time; and taking the maximum value in the resource loading time as the first rendering time of the browser. The method can approximately calculate the first rendering time, does not need to invade business code burying point approximate calculation, is high in operability, and cannot affect the business code.

Description

technical field [0001] The embodiments of the present invention relate to the technical field of webpage development, and in particular to a method, device, browser and storage medium for calculating the first rendering time of a browser. Background technique [0002] The first rendering time refers to the time when a browser starts to display content, and is an important indicator for measuring user experience of a global wide area network (World Wide Web, Web). It is generally considered that the moment when the browser starts rendering the body tag of the document or parses the head tag of the document is the first rendering time. The general process is divided into the browser establishing a link with the server, the server processing and responding to the browser request, and the browser downloading, parsing, rendering and displaying the page. [0003] In the existing technology, the mainstream calculation method of the first rendering time is the approximate calculati...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/445G06F11/34G06F16/958
CPCG06F16/958G06F9/44521G06F11/3409Y02D10/00
Inventor 李超覃煜王聪
Owner 北京博睿宏远数据科技股份有限公司