Script loading method and device

A technology for loading devices and scripts, applied in the field of communication, can solve the problems of poor versatility and flexibility of web application development, and achieve the effect of improving the versatility and flexibility

Active Publication Date: 2012-07-11
江苏龙力泵阀制造有限公司
View PDF4 Cites 29 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, this lazy loading method requires the development of initial scripts, and clearly specifies which background JavaScript script file needs to be lazy loaded during

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
  • Script loading method and device
  • Script loading method and device
  • Script loading method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0025] figure 1 It is a flow chart of the script loading method provided by Embodiment 1 of the present invention. Such as figure 1 As shown, the script loading method provided in this embodiment can be specifically applied to the script loading process, especially can be applied to the browser's processing process of the lazy loaded script, and the script can specifically be a JavaScript script. The script loading method provided in this embodiment can be executed by a script loading device, a browser can be set in the loading device, and it can be realized by means of software and hardware. When a user browses a webpage through a browser, the browser receives a page loading request, loads the webpage, and executes the source file of the webpage. If the programmer sets some page data and scripts of the web page as lazy loading during the web page development process, then during the initial web page loading process, the browser will only download the web page data and scrip...

Embodiment 2

[0042] figure 2 It is a flow chart of the script loading method provided by Embodiment 2 of the present invention. Such as figure 2 As shown, the script loading method provided by this embodiment is in figure 1 Based on the above embodiment, preferably, the script reference code corresponding to the lazy loaded script can be recorded in the source file of the web page. The script reference code indicates that the script referenced by the script reference code is lazy loaded by setting an identifier.

[0043] For example, taking a JavaScript script as an example, the lazy loading of the JavaScript script can be implemented by extending the additional information of the Script tag. The defer attribute can be defined in the Script tag, and the defer attribute is used to indicate whether to delay the execution of the script until the page is loaded. When the script reference code contains the defer attribute, and the value of the defer attribute is "defer", the script is dow...

Embodiment 3

[0056] image 3 It is a flow chart of the script loading method provided by the third embodiment of the present invention. Such as image 3 As shown, in the script loading method provided by this embodiment, step 20, if the script does not exist in the script storage unit, obtain the script reference code corresponding to the calling method according to the method name, which may specifically include the following steps :

[0057] Step 203. If the script does not exist in the script storage unit, obtain a mapping table, wherein the mapping table stores a mapping relationship between the method name and the script information of the script, and the script information includes Script name and storage path;

[0058] The source file of the webpage may also indicate lazy loading in other ways, such as not recording the script reference code corresponding to the script that needs to be lazy loaded in the source file. Since the script reference code does not exist in the source f...

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 provides a script loading method and a device. The script loading method comprises the steps of: when receiving a business logic function trigger request carrying a method name of a call method, judging whether a script corresponding to the call method exists in a script storage unit; if the script does not exists in the script storage unit, obtaining a script reference code corresponding to the call method according to the method name; and performing the script reference code, downloading and analyzing the script corresponding to the script reference code, and performing the call method in the script. According to the script loading method and the device provided by the embodiment of the invention, the defects of higher conventionality and coupling of the foreground and the background, which are caused by reserving an entry of a callback function in an initial script of a webpage in the process of developing a Web application program and definitely appointing which script needs to be lazily loaded, and the commonality and flexibility of the Web application development are improved.

Description

technical field [0001] The invention relates to communication technology, in particular to a script loading method and device. Background technique [0002] With the wide application of Internet technology, Web technology has been widely used on the Internet, but the early Web applications were all static Hypertext Markup Language (Hypertext Markup Language, HTML) pages, used to present some text information to the viewer, These information are fixedly written in the HTML page, which does not have the ability to interact with the user, and does not have the function of dynamic display. Today's web applications are no longer purely static web page models, but comprehensive applications that include web pages, programs, databases, and other data storage forms that can realize information query, addition, deletion, modification, and interactive operations. [0003] JavaScript is a scripting language widely used in client-side web development. It is often used to add dynamic fu...

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
IPC IPC(8): G06F17/30
CPCG06F17/30G06F16/958
Inventor 孙尹
Owner 江苏龙力泵阀制造有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products