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
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
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...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com