WO2013097592A1 - 脚本加载技术 - Google Patents
脚本加载技术 Download PDFInfo
- Publication number
- WO2013097592A1 WO2013097592A1 PCT/CN2012/086247 CN2012086247W WO2013097592A1 WO 2013097592 A1 WO2013097592 A1 WO 2013097592A1 CN 2012086247 W CN2012086247 W CN 2012086247W WO 2013097592 A1 WO2013097592 A1 WO 2013097592A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- script
- reference code
- code
- loading
- source file
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
Definitions
- the present invention relates to the field of communications, and in particular, to an enhanced script loading technique.
- BACKGROUND With the widespread application of internet technology, Web technology has been widely used on the Internet, but early Web applications are all static Hypertext Markup Language (HTML) pages for presenting some text information to browse. The information is fixedly written in the HTML page. The page does not have the ability to interact with the user, and there is no dynamic display function.
- HTML Hypertext Markup Language
- Today's Web applications are not purely static webpage patterns, but comprehensive applications that include web pages, programs, databases, and other forms of data storage that enable query, addition, deletion, and interaction of information.
- JavaScript is a scripting language widely used for client-side web development. It is often used to add dynamic functionality to HTML pages, such as responding to user actions. Web applications often require large JavaScript foreground scripts to implement complex logic and effects. Downloading, parsing, and executing JavaScript scripts consumes more browser performance, and Web applications do not provide immediate user interaction until the full script is fully loaded. ability. Huge JavaScript scripts take up network bandwidth resources, and usually not all JavaScript scripts are used immediately. And these temporarily useless JavaScript scripts spend a lot of time and bandwidth on the user. In response to these problems, the prior art provides a method for lazy loading of JavaScript scripts.
- the custom JavaScript script is used to reserve the entry of the callback function in the initial script loaded in the foreground, when the business logic function requires (logical judgment or timing)
- the Ajax request requests and downloads the JavaScript script of the corresponding function to the server, and returns to the foreground browser before parsing.
- this lazy loading method requires the development of an initial script, and explicitly specifies which back-end JavaScript script file needs to be lazily loaded during program development.
- the front and back-end conventions and coupling are high, so that the versatility and flexibility of web application development. Both are poor.
- Embodiments of the present invention provide a script loading method and apparatus to improve the versatility and flexibility of web application development.
- the embodiment of the invention provides a script loading method, including:
- script storage unit If the script does not exist in the script storage unit, obtain a script reference code corresponding to the calling method according to the method name;
- An embodiment of the present invention provides a script loading apparatus, including:
- a judging unit configured to receive a business logic function touch of a method name carrying a calling method When the request is sent, determining whether the script corresponding to the calling method exists in the script storage unit; the script reference code obtaining unit, configured to acquire the call according to the method name if the script does not exist in the script storage unit The script reference code corresponding to the method;
- a code execution unit configured to execute the script reference code, execute the script reference code, download and parse a script corresponding to the script reference code, and execute the calling method in the script.
- the script loading method and apparatus when receiving the service logic function triggering request carrying the method name of the calling method, determining whether the script corresponding to the calling method exists in the script storage unit, If it does not exist, the script reference code corresponding to the calling method is obtained according to the method name. Then execute the script reference code, download and parse the script corresponding to the script reference code, and execute the calling method in the script. Since the browser is in the manner of obtaining the script reference code corresponding to the calling method, the execution of the calling method is finally implemented by executing the script reference code, thereby avoiding the entry of the callback function in the initial script of the webpage during web application development.
- 1 is a flowchart of a script loading method according to Embodiment 1 of the present invention
- 2 is a flowchart of a script loading method according to Embodiment 2 of the present invention
- FIG. 3 is a flowchart of a script loading method according to Embodiment 3 of the present invention.
- FIG. 4 is a schematic structural diagram of a script loading apparatus according to Embodiment 4 of the present invention.
- FIG. 5 is a schematic structural diagram of a script loading apparatus according to Embodiment 5 of the present invention.
- FIG. 6 is a schematic structural diagram of a script loading apparatus according to Embodiment 6 of the present invention.
- the technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention.
- the embodiments are a part of the embodiments of the invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
- the user usually browses the webpage through the browser, and the browser receives the page loading request, loads the webpage corresponding to the page loading request, and executes the source file of the webpage.
- the source file is usually code written in HTML, and the script reference code can be embedded in the source file to load the script.
- Lazy Loading is a mode in Web development where partial page data or scripts are not downloaded to the browser by default.
- the server is requested to download the response data. Through the lazy loading of scripts, you can download and execute the script when you need to execute the script to avoid the bandwidth of network resources.
- FIG. 1 is a flowchart of a script loading method according to Embodiment 1 of the present invention.
- the script loading method provided in this embodiment may be specifically applied to a script loading process, and in particular, may be applied.
- the script can be a JavaScript script.
- the script loading method provided in this embodiment can be executed by a script loading device.
- the loading device can be configured with a browser, which can be implemented by software and hardware. When the user browses the webpage through the browser, the browser receives the page loading request, loads the webpage, and executes the source file of the webpage.
- the browser only downloads the webpage data and scripts that need to be downloaded immediately to the local, and stores them in the script storage. In the cell, do not download these page data and scripts that require lazy loading to the local.
- the script storage unit may be specifically set in the loading device or may be separately set.
- the calling method for implementing the function needs to be called in the process of implementing a certain function
- the calling The method may be a function
- the browser generates a service logic function triggering request for invoking the calling method, and the service logic function triggers the method name of the calling method in the request.
- Step 10 When the script loading device receives the business logic function trigger request carrying the method name of the calling method, determine whether the script corresponding to the calling method exists in the script storage unit.
- the calling method is usually recorded in the script.
- the script stored in the script storage unit is queried according to the method name, and the script corresponding to the calling method is determined in the script storage unit. If the script exists in the script storage unit, The script corresponding to the calling method has been downloaded to the script storage unit during the initial page loading process. The script is parsed, and the calling method in the script is executed to implement the corresponding function. If the script does not exist in the script storage unit, the call is indicated
- the script corresponding to the method is a lazy loaded script, ie the script has not been downloaded and stored in the script storage unit.
- Step 20 If the script does not exist in the script storage unit, the script loading device acquires a script reference code corresponding to the calling method according to the method name;
- the script reference code corresponding to the calling method is obtained according to the method name.
- the script reference code is specifically a piece of code. By executing the code, the download and execution of the script can be implemented.
- the script reference code may be obtained from a source file corresponding to the webpage, or may be generated according to the method name, and may also set a mapping relationship table between the method name and the script reference code to obtain a script reference code according to the method name, and the script reference code
- the specific acquisition manner is not limited to this embodiment.
- Step 30 Execute the script reference code, download and parse the script corresponding to the script reference code, and execute the calling method in the script.
- the browser executes the script reference code, downloads and parses the script corresponding to the script reference code.
- the script can be obtained by sending a Hyper Text Transfer Protocol (HTTP) request to the server. Execute the calling method in the script and display the execution result to the user to implement the corresponding business logic function.
- HTTP Hyper Text Transfer Protocol
- the user browses the webpage through the browser, the browser executes the source file of the webpage, downloads the webpage data and the script, and stores the script in the script storage unit.
- the business logic function trigger request is generated.
- the service logic function triggers the method name of the method that carries the calling method in the request.
- the script that records the JavaScript script that calls the method is com. huawe i . iread. js, which is the character segment of the method name except the last character segment com. huawei. iread is the JavaScript corresponding to the calling method.
- the name of the script According to the method name, the script stored in the script storage unit is queried. If the JavaScript script does not exist in the script storage unit, the script reference code corresponding to the calling method is obtained according to the method name.
- the script reference code can refer to the server-side JavaScript script by means of a script mark.
- the specific format is as follows:
- the type attribute is used to indicate the MIME type of the script.
- the src attribute is used to indicate the Uniform / Universal Resource Locator (URL) of the external script.
- Com. huawei. iread. js is the Javascript script corresponding to the calling method.
- the URL is the storage path of the JavaScript script.
- the browser executes the script reference code, downloads and parses the JavaScript script com. huawei. iread. js, executes the calling method com. huawei. iread. hel loWord ().
- the script loading method when receiving the service logic function triggering request carrying the method name of the calling method, determining whether the script corresponding to the calling method exists in the script storage unit, and if not, according to the method name Get the script reference code corresponding to the calling method. Then execute the script reference code, download and parse the script corresponding to the script reference code, and execute the calling method in the script. Since the browser is in the manner of obtaining the script reference code corresponding to the calling method, the execution of the calling method is finally implemented by executing the script reference code, thereby avoiding the opening of the web application.
- the entry of the callback function is reserved in the initial script of the webpage, and it is necessary to explicitly specify which script needs to be lazily loaded, and the defects of the front and back office are high and the coupling is high, which improves the versatility of the web application development. And flexibility.
- FIG. 2 is a flowchart of a script loading method according to Embodiment 2 of the present invention.
- the script loading method provided in this embodiment is based on the embodiment shown in FIG. 1.
- the script reference code corresponding to the lazy loaded script can be recorded in the source file of the webpage.
- the script reference code indicates that the script referenced by the script reference code is lazy loaded by setting the identifier.
- the defer attribute can be defined in the script tag, and the defer attribute is used to indicate whether the script execution is delayed until the page is loaded.
- the script reference code contains the defer attribute, and the value of the defer attribute is "defer”
- the script is downloaded during the page load process, but the script is not executed immediately, and the script is not executed until the page is loaded. It is possible to pre-set that when the value of the defer attribute is other than "defer", it indicates that the script is lazily loaded.
- the script reference code can be:
- step 10 when the service logic function triggering request carrying the method name of the calling method is received, before determining whether the script corresponding to the calling method exists in the script storage unit, the following may further include the following: Step:
- Step 40 When receiving a page load request, execute a code in a source file of a page corresponding to the page load request, where the script reference code that is included in the source file is included When the identifier indicating lazy loading is indicated, the script reference code is skipped.
- a page load request is a request generated by a browser to load a web page when a user browses a website through a browser.
- the code in the source file of the page corresponding to the page load request is executed, that is, the initial page load operation is performed.
- the script in the script reference code needs lazy loading, then skip the script reference code. Not executed.
- the script reference code can be recorded in the source file during web development, which facilitates the acquisition of subsequent script reference code.
- executing the code in the source file of the page corresponding to the page loading request may further include the following steps:
- the script reference code is executed, the script corresponding to the script reference code is downloaded, and the script is stored in the In the script storage unit.
- the script storage unit when the business logic function triggers the calling method in the script, the script storage unit can be searched to obtain the corresponding script.
- Step 20 If the script does not exist in the script storage unit, the script reference code corresponding to the calling method is obtained according to the method name, and specifically includes the following steps:
- Step 201 If the script does not exist in the script storage unit, searching for a code in the source file according to the method name; Step 202: If there is a script reference code matching the method name in the source file, obtain the script reference code.
- the script reference code corresponding to the lazy loaded script is recorded in the source file of the webpage, but the script reference code is not executed in the initial loading of the page.
- the code in the source file may be searched according to the method name of the calling method to obtain the script reference code corresponding to the script.
- FIG. 3 is a flowchart of a script loading method according to Embodiment 3 of the present invention. As shown in FIG. 3, the script loading method is provided in this embodiment. Step 20: If the script does not exist in the script storage unit, obtain a script reference code corresponding to the calling method according to the method name, specifically It can include the following steps:
- Step 203 If the script does not exist in the script storage unit, obtain a mapping table, where the mapping table stores a mapping relationship between the method name and script information of the script, where the script information is Includes script name and storage path;
- the lazy loading can also be indicated in other ways by the source file of the web page, such as 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 file, the script reference code is not executed during the initial page loading process, and the lazy loading of the script can be realized. The method is simple to implement.
- the mapping table When the script reference code does not exist in the source file, the mapping table is obtained.
- the mapping table stores a mapping relationship between the method name and the script information of the script, and the script information includes a script name and a storage path.
- the method name is com. huawei. iread. hel loWord, corresponding to the script name com. huawei. iread and storage path. . /script/.
- Step 204 Perform a search on the mapping table according to the method name, and obtain script information corresponding to the method name.
- Step 205 Construct the script reference code according to the script information.
- the script information of the script can be obtained according to the method name. Since the script information includes the script name and the storage path, the script reference code can be constructed according to the script name and the storage path.
- the script reference code may be obtained by constructing a script reference code according to the script information according to a pre-agreed.
- the source file may also be first queried according to the method name. If the source file exists in the script reference code whose method name matches, the execution of the script reference code is performed by executing steps 201 and 202, if the source file is in the source file. When there is no script reference code matching the method name, the script reference code can be obtained by the method provided in this embodiment.
- FIG. 4 is a schematic structural diagram of a script loading apparatus according to Embodiment 4 of the present invention. As shown in FIG. 4, the script loading device provided in this embodiment may implement various steps of the script loading method provided by any embodiment of the present invention, and details are not described herein.
- the script loading apparatus specifically includes a determining unit 12, a script reference code acquiring unit 13, and a code executing unit 14.
- the determining unit 12 is configured to determine, when the service logic function triggering request carrying the method name of the calling method, the script corresponding to the calling method exists in the script storage unit 11.
- the script reference code obtaining unit 13 is configured to acquire a script reference code corresponding to the calling method according to the method name, if the script does not exist in the script storage unit 11, and the code executing unit 14 is configured to execute the script reference Code, executing the script reference code, downloading and parsing a script corresponding to the script reference code, executing the caller in the script Law.
- the determining unit 12 when the determining unit 12 receives the service logic function triggering request carrying the method name of the calling method, it is determined whether the script corresponding to the calling method exists in the script storage unit 11. If the script does not exist in the script storage unit 11, the script reference code obtaining unit 13 acquires the script reference code corresponding to the calling method according to the method name, and the code execution unit 14 executes the script reference code, and executes the The script reference code downloads and parses the script corresponding to the script reference code, and executes the calling method in the script.
- the script reference code obtaining unit 13 and the code executing unit 14 to obtain the manner of calling the script reference code corresponding to the method, the execution of the calling method is finally implemented by executing the script reference code, and the web application is avoided.
- the entry of the callback function is reserved in the initial script of the webpage, and it is necessary to explicitly specify which script needs to be lazily loaded, and the defects of the front and back office are high and the coupling is high, which improves the versatility of the web application development. And flexibility.
- FIG. 5 is a schematic structural diagram of a script loading apparatus according to Embodiment 5 of the present invention.
- the script loading device provided in this embodiment is based on the embodiment shown in FIG. 4, and the script reference code obtaining unit 13 may specifically include a lookup subunit 131 and a code obtaining subunit 132.
- the lookup subunit 131 is configured to search for a code in the source file according to the method name if the script does not exist in the script storage unit 11.
- the code acquisition sub-unit 132 is configured to acquire the script reference code if there is a script reference code matching the method name in the source file.
- the script reference code can be obtained from the source file of the page, which improves the convenience of obtaining the script reference code.
- the script loading device may further include a source file execution unit 15, the source.
- the file execution unit 15 is configured to execute, when the page load request is received, the code in the source file of the page corresponding to the page load request, where the script reference code that is included in the source file is included to indicate lazy loading When the identity is identified, the script reference code is skipped.
- the script reference code can be recorded in the source file during web development, which facilitates the acquisition of subsequent script reference code.
- the source file execution unit 15 is further configured to execute the script reference code when the script reference code that identifies the source file does not include the identifier to indicate lazy loading.
- the script refers to a script corresponding to the code, and stores the script in the script storage unit 11. In the initial page load operation, if it is recognized that the script reference code does not include an identifier for indicating lazy loading, the script is downloaded, and the script is stored in the script storage unit 11 so that when the business logic function triggers the call Script storage unit when calling methods in scripts
- FIG. 6 is a schematic structural diagram of a script loading apparatus according to Embodiment 6 of the present invention.
- the script loading device provided in this embodiment is based on the embodiment described in FIG. 4
- the script reference code acquiring unit 13 may specifically include a mapping table obtaining sub-unit 133 and a script information acquiring sub-unit 134 .
- the mapping table obtaining sub-unit 133 is configured to obtain a mapping table if the script does not exist in the script storage unit, where the mapping table stores a mapping relationship between the method name and the script information of the script.
- the script information includes a script name and a storage path.
- the script information obtaining sub-unit 134 is configured to search the mapping table according to the method name, and obtain script information corresponding to the method name.
- the code construction sub-unit 135 is configured to construct the script reference code according to the script information. If the script reference code does not exist in the source file, the script reference code can be obtained by constructing a script reference code. Alternatively, if the webpage development convention is in the form of not recording the script reference code corresponding to the lazy loaded script in the source file, the script reference code may be obtained by constructing the script reference code.
- the script loading method and device when receiving the service logic function triggering request carrying the method name of the calling method, determining whether the script corresponding to the calling method exists in the script storage unit, if not, according to The method name gets the script reference code corresponding to the calling method. Then execute the script reference code, download and parse the script corresponding to the script reference code, and execute the calling method in the script. Since the browser is to obtain the script reference code corresponding to the calling method, the execution of the calling method is finally implemented by executing the script reference code, thereby avoiding the entry of the callback function in the initial script of the webpage during web application development.
- the technical solution provided by the embodiment can be used to implement lazy loading of a script. On the basis of implementing a complex web application, system resource waste and network bandwidth consumption are avoided.
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
- Stored Programmes (AREA)
Abstract
本发明实施例提供一种脚本加载技术,包括当接收到携带有调用方法的方法名称的业务逻辑功能触发请求时,判断脚本存储单元中是否存在所述调用方法对应的脚本;若所述脚本存储单元中不存在所述脚本,则根据所述方法名称获取所述调用方法对应的脚本引用代码;执行所述脚本引用代码,下载并解析所述脚本引用代码对应的脚本,执行所述脚本中的所述调用方法。
Description
脚本加载技术 本申请要求于 2011 年 12 月 28 日提交中国专利局、 申请号为 201110446680. 6、发明名称为 "脚本加载方法及装置" 的中国专利申请的优 先权, 其全部内容通过引用结合在本申请中。 技术领域
本发明涉及通信领域, 尤其涉及一种增强的脚本加载技术。 背景技术 随着 internet技术的广泛应用, Web技术已经广泛应用于 internet上, 但是早期的 Web 应用全部是静态的超文本标记语言 (Hypertext Markup Language , HTML) 页面, 用于将一些文本信息呈现给浏览者, 这些信息是固 定写在 HTML页面里的, 该页面不具备与用户交互的能力, 没有动态显示的 功能。 现在的 Web应用已经不是纯静态的网页模式, 而是包括网页、 程序、 数据库及其它数据存储形式在内的能够实现对信息的查询、增删改和交互操 作的综合应用。
JavaScript是一种广泛用于客户端 Web开发的脚本语言,常用来给 HTML 网页添加动态功能, 比如响应用户的各种操作。 Web 应用通常需要庞大的 JavaScript 前台脚本来实现复杂的逻辑和效果, 下载、 解析和执行 JavaScript 脚本需要耗损更多浏览器性能, 同时, 在全量脚本没有加载完 全前, Web应用也不能立刻提供用户交互能力。 庞大的 JavaScript脚本会 占用网络带宽资源,而且通常并不是所有的 JavaScript脚本会被立刻使用,
而这些暂时无用的 JavaScript脚本却花费的用户的集中的时间和带宽。 针对这些问题, 现有技术提供了一种惰性加载 JavaScript脚本的方法, 通过自定义的 JavaScript脚本,在前台已加载的初始脚本中预留回调函数的 入口, 当业务逻辑功能需要 (逻辑判断或定时器触发) 或用户手动触发的时 候, 通过 Ajax请求向服务器端请求并下载相应功能的 JavaScript脚本, 返 回到前台浏览器后再进行解析运行。 但是这种惰性加载的方法需要开发初始 脚本,且在程序开发时就明确指定需要惰性加载哪个后台 JavaScript脚本文 件, 前后台的约定性和耦合性较高, 以致 Web应用开发的通用性和灵活性都 比较差。 发明内容 本发明实施例提供一种脚本加载方法及装置, 以提高 Web应用开发的通 用性和灵活性。
本发明实施例提供一种脚本加载方法, 包括:
当接收到携带有调用方法的方法名称的业务逻辑功能触发请求时, 判断 脚本存储单元中是否存在所述调用方法对应的脚本;
若所述脚本存储单元中不存在所述脚本, 则根据所述方法名称获取所述 调用方法对应的脚本引用代码;
执行所述脚本引用代码, 下载并解析所述脚本引用代码对应的脚本, 执 行所述脚本中的所述调用方法。
本发明实施例提供一种脚本加载装置, 包括:
判断单元,用于当接收到携带有调用方法的方法名称的业务逻辑功能触
发请求时, 判断脚本存储单元中是否存在所述调用方法对应的脚本; 脚本引用代码获取单元, 用于若所述脚本存储单元中不存在所述脚本, 则根据所述方法名称获取所述调用方法对应的脚本引用代码;
代码执行单元, 用于执行所述脚本引用代码, 执行所述脚本引用代码, 下载并解析所述脚本引用代码对应的脚本, 执行所述脚本中的所述调用方 法。
由上述技术方案可知, 本发明实施例提供的脚本加载方法及装置, 当接 收到携带有调用方法的方法名称的业务逻辑功能触发请求时,判断脚本存储 单元中是否存在该调用方法对应的脚本, 若不存在, 则根据该方法名称获取 调用方法对应的脚本引用代码。 再执行该脚本引用代码, 下载并解析脚本引 用代码对应的脚本, 执行该脚本中的调用方法。 由于浏览器是以获取调用方 法对应的脚本引用代码的方式,通过执行该脚本引用代码最终实现调用方法 的执行,避免了在 Web应用程序开发时就在网页的初始脚本中预留回调函数 的入口, 且需明确指定需要惰性加载哪个脚本, 而造成的前后台的约定性和 耦合性较高的缺陷, 提高了 Web应用开发的通用性和灵活性。 附图说明 为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见地, 下 面描述中的附图是本发明的一些实施例, 对于本领域普通技术人员来讲, 在 不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例一提供的脚本加载方法流程图;
图 2为本发明实施例二提供的脚本加载方法流程图;
图 3为本发明实施例三提供的脚本加载方法流程图;
图 4为本发明实施例四提供的脚本加载装置结构示意图;
图 5为本发明实施例五提供的脚本加载装置结构示意图;
图 6为本发明实施例六提供的脚本加载装置结构示意图。 具体实施方式 为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发 明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于 本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获 得的所有其他实施例, 都属于本发明保护的范围。
用户通常通过浏览器来浏览网页, 浏览器接收到页面加载请求, 加载该 页面加载请求对应的网页, 执行网页的源文件。 源文件通常为 HTML编写的代 码, 源文件中可以嵌入有脚本引用代码, 以实现对脚本的加载。 惰性加载 ( Lazy Loading) 是 Web开发中的一种模式, 即在默认情况下部分页面数据 或者脚本不下载到浏览器, 当用户触发或应用程序逻辑触发时, 再向服务器 请求下载响应的数据。 通过脚本的惰性加载, 可以在需要执行脚本时再将该 脚本下载并执行, 避免网络资源带宽的占用。
实施例一
图 1为本发明实施例一提供的脚本加载方法流程图。 如图 1所示, 本实施 例提供的脚本加载方法具体可以应用于脚本加载处理过程, 尤其是可以应用
于浏览器对惰性加载的脚本的处理过程, 脚本具体可以为 JavaScript脚本。 本实施例提供的脚本加载方法可以通过脚本加载装置来执行, 该加载装置中 可以设置有浏览器, 可以通过软件和硬件的方式来实现。 用户通过浏览器浏 览网页时, 浏览器接收到页面加载请求, 加载网页, 执行网页的源文件。 若 程序员在网页开发过程中设置该网页的部分页面数据和脚本为惰性加载, 则 在初始的网页加载过程中, 浏览器只将需要当即下载的网页数据和脚本下载 到本地, 存储在脚本存储单元中, 而不将这些需要惰性加载的页面数据和脚 本下载到本地。 脚本存储单元具体可以设置在该加载装置中也可以单独设 置。
浏览器执行网页的源文件的过程中, 当网页中的业务逻辑判断触发或定 时触发, 或者被用户手动点击触发时, 在实现某个功能的过程中需要调用实 现该功能的调用方法, 该调用方法具体可以为一个函数, 则浏览器生成用以 指示调用该调用方法的业务逻辑功能触发请求, 该业务逻辑功能触发请求中 携带有该调用方法的方法名称。
本实施例提供的脚本加载方法具体包括:
歩骤 10、 当脚本加载装置接收到携带有调用方法的方法名称的业务逻辑 功能触发请求时, 判断脚本存储单元中是否存在所述调用方法对应的脚本。
具体的, 调用方法通常记录在脚本中, 首先根据方法名称对脚本存储单元 中存储的脚本进行查询,判断脚本存储单元中是否存在该调用方法对应的脚本, 若该脚本存储单元中存在该脚本, 说明该调用方法对应的脚本在初始的页面加 载过程中已经下载到了脚本存储单元中。 对该脚本进行解析, 执行脚本中的调 用方法, 以实现相应的功能。 若该脚本存储单元中不存在该脚本, 说明该调用
方法对应的脚本为惰性加载的脚本, 即该脚本还未下载并存储到脚本存储单元 中。
歩骤 20、 若所述脚本存储单元中不存在所述脚本, 则该脚本加载装置根 据所述方法名称获取所述调用方法对应的脚本引用代码;
若脚本存储单元中不存在该脚本, 则根据该方法名称获取该调用方法对 应的脚本引用代码。 脚本引用代码具体为一段代码, 通过执行该代码, 可以 对实现该脚本的下载及执行。该脚本引用代码可以从网页对应的源文件中获 取, 也可以根据该方法名称生成, 还可以设置方法名称与脚本引用代码的映 射关系表, 以根据该方法名称获取脚本引用代码, 脚本引用代码的具体获取 方式不以本实施例为限。
歩骤 30、 执行所述脚本引用代码, 下载并解析所述脚本引用代码对应的 脚本, 执行所述脚本中的所述调用方法。
浏览器执行该脚本引用代码, 下载并解析脚本引用代码对应的脚本。 具 体可以通过向服务器发送超文本传输协议 (Hyper Text Transfer Protocol , 简称 HTTP )请求的方式获取该脚本。 执行该脚本中的调用方法, 并向用户显 示执行结果, 以实现相应的业务逻辑功能。
以下以 JavaScript脚本为例对本实施例提供的脚本加载方法的实现过 程做详细说明:
用户通过浏览器浏览网页, 浏览器执行网页的源文件, 下载网页数据和 脚本, 并将脚本存储在脚本存储单元中。 当用户点击触发业务逻辑需要调用 调用方法 com. huawei. iread. hel loWord ()时, 生成业务逻辑功能触发请求。 该业务逻辑功能触发请求中携带有调用方法的方法名称, 为
com. huawei. iread. hel lo
Word , 根据命名规则, 记录有该调用方法的 JavaScript脚本的脚本为 com. huawe i . iread. j s, 即方法名称的除最后一个字符段以外的字符段 com. huawei. iread为调用方法对应的 JavaScript脚本的名称。根据该方法名 称对脚本存储单元中存储的脚本进行查询, 若脚本存储单元中不存在该 JavaScript脚本, 则根据该方法名称获取该调用方法对应的脚本引用代码。
具体地, 脚本引用代码可以通过 Script标记的方式引用服务器端的 JavaScript脚本。 具体格式如下:
<script type="text/ javascript" src=〃. . / script/ com. huawei. iread. j s〃〉
其中, Script标记中, type属性用以指示脚本的 MIME 类型。 src属性 用以指示外部脚本的统一资源定位符 (Uniform / Universal Resource Locator ,简称 URL)。 com. huawei. iread. js即为调用方法对应的 J avaScript 脚本, URL为该 JavaScript脚本的存储路径。
浏览器执行该脚本引用代码, 下载并解析 JavaScript脚本 com. huawei. iread. js, 执行调用方法 com. huawei. iread. hel loWord ()。
本实施例提供的脚本加载方法, 当接收到携带有调用方法的方法名称的 业务逻辑功能触发请求时, 判断脚本存储单元中是否存在该调用方法对应的 脚本, 若不存在, 则根据该方法名称获取调用方法对应的脚本引用代码。 再 执行该脚本引用代码, 下载并解析脚本引用代码对应的脚本, 执行该脚本中 的调用方法。 由于浏览器是以获取调用方法对应的脚本引用代码的方式, 通 过执行该脚本引用代码最终实现调用方法的执行, 避免了在 Web应用程序开
发时就在网页的初始脚本中预留回调函数的入口, 且需明确指定需要惰性加 载哪个脚本, 而造成的前后台的约定性和耦合性较高的缺陷, 提高了 Web应 用开发的通用性和灵活性。
实施例二
图 2为本发明实施例二提供的脚本加载方法流程图。 如图 2所示, 本实施 例提供的脚本加载方法在图 1所述实施例的基础上, 较优的, 惰性加载的脚 本对应的脚本引用代码可以记录在网页的源文件中。该脚本引用代码中通过 设置标识的方式指示该脚本引用代码引用的脚本为惰性加载。
例如, 以 JavaScript脚本为例, 可以通过扩展 Script标记附加信息的方 式来实现对 JavaScript脚本的惰性加载。 Script标记中可以定义 defer属性, defer属性用以指示是否对脚本执行进行延迟, 直到页面加载为止。 当脚本 引用代码中包含有 defer属性, 且 defer属性的值为 " defer " , 则在页面加 载的过程中下载该脚本, 但并不立即执行该脚本, 直到页面加载完毕, 才执 行该脚本。 可以预先设定当 defer属性的值为除 " defer " 以外的其他值时, 指示惰性加载该脚本。 该脚本引用代码具体可以为:
<script type=〃text/ javascript〃 def er=〃a〃 src=〃. . I script/ com. huawei. iread. j s〃〉
在本实施例中, 歩骤 10, 当接收到携带有调用方法的方法名称的业务逻 辑功能触发请求时, 判断脚本存储单元中是否存在所述调用方法对应的脚本 之前, 具体还可以包括如下歩骤:
歩骤 40、 当接收到页面加载请求时, 执行所述页面加载请求对应的页面 的源文件中的代码, 其中, 若识别到所述源文件的脚本引用代码中包含有用
以指示惰性加载的标识时, 跳过所述脚本引用代码。
页面加载请求即为用户通过浏览器浏览网站时生成的请求浏览器加载 网页页面的请求。 当浏览器接收到页面加载请求时, 执行该页面加载请求对 应的页面的源文件中的代码, 即进行初始的页面加载操作。 在代码的执行过 程中, 若识别到脚本引用代码中包含有用以指示惰性加载的标识, 如 defer= " a" , 则说明该脚本引用代码中的脚本需要惰性加载, 则跳过该脚本引用 代码不执行。 通过在脚本引用代码中设置标识以指示惰性加载, 在网页开发 时就可以将该脚本引用代码记录在源文件中, 为后续的脚本引用代码的获取 提供方便。
在本实施例中, 执行所述页面加载请求对应的页面的源文件中的代码, 具体还可以包括如下歩骤:
若识别到所述源文件的脚本引用代码中不包含用以指示惰性加载的所 述标识时, 执行所述脚本引用代码, 下载所述脚本引用代码对应的脚本, 并 将所述脚本存储在所述脚本存储单元中。
在初始的页面加载操作中, 若识别到脚本引用代码中不包含用以指示惰 性加载的标识, 即说明该脚本引用代码对应的脚本可以当即下载, 则下载该 脚本, 并将该脚本存储在脚本存储单元中, 以便当业务逻辑功能触发调用该 脚本中的调用方法时, 可以对脚本存储单元进行查找以获取相应的脚本。
歩骤 20, 若所述脚本存储单元中不存在所述脚本, 则根据所述方法名称 获取所述调用方法对应的脚本引用代码, 具体可以包括如下歩骤:
歩骤 201、 若所述脚本存储单元中不存在所述脚本, 则根据所述方法名 称对源文件中的代码进行查找;
歩骤 202、若所述源文件中存在与所述方法名称相匹配的脚本引用代码, 则获取所述脚本引用代码。
上述实施方式中,惰性加载的脚本对应的脚本引用代码记录在网页的源 文件中, 但在页面的初始加载中并不执行该脚本引用代码。 当脚本存储单元 中不存在需调用的调用方法对应的脚本时, 则可以根据该调用方法的方法名 称对源文件中的代码进行查找, 以获得该脚本对应的脚本引用代码。
实施例三
图 3为本发明实施例三提供的脚本加载方法流程图。 如图 3所示, 本实施 例提供的脚本加载方法, 歩骤 20, 若所述脚本存储单元中不存在所述脚本, 则根据所述方法名称获取所述调用方法对应的脚本引用代码, 具体可以包括 如下歩骤:
歩骤 203、 若所述脚本存储单元中不存在所述脚本, 则获取映射表, 其 中, 所述映射表中存储有所述方法名称与所述脚本的脚本信息的映射关系, 所述脚本信息包括脚本名称和存储路径;
网页的源文件中也可以通过其他方式指示惰性加载, 如在源文件中不记 录需要惰性加载的脚本对应的脚本引用代码。 由于源文件中不存在该脚本引 用代码, 则在初始的页面加载过程中, 该脚本引用代码不被执行, 即可实现 对脚本的惰性加载, 该方法实现简单。
当源文件中不存在该脚本引用代码时, 获取映射表。 该映射表中存储有 方法名称与脚本的脚本信息的映射关系, 该脚本信息包括脚本名称和存储路 径。 例如方法名称为 com. huawei. iread. hel loWord, 与脚本名称 com. huawei. iread禾口存储路径. . /script/相对应。
歩骤 204、 根据所述方法名称对所述映射表进行查找, 获取所述方法名 称对应的脚本信息;
歩骤 205、 根据所述脚本信息构建所述脚本引用代码。
根据方法名称可以获取到脚本的脚本信息, 又由于脚本信息中包括了脚 本名称和存储路径, 可以根据脚本名称和存储路径构建脚本引用代码。
值得注意的是, 在本实施例中, 可以根据预先约定, 通过根据脚本信息 构建脚本引用代码的方式来获取该脚本引用代码。也可以首先根据方法名称 对源文件进行查询, 若源文件中存在于该方法名称相匹配的脚本引用代码 时, 通过执行歩骤 201和歩骤 202来实现脚本引用代码的获取, 若源文件中不 存在与方法名称相匹配的脚本引用代码时, 可以通过本实施例提供的方法来 获取脚本引用代码。
实施例四
图 4为本发明实施例四提供的脚本加载装置结构示意图。 如图 4所示, 本 实施例提供的脚本加载装置具体可以实现本发明任意实施例提供的脚本加 载方法的各个歩骤, 此不再赘述。
本实施例提供的脚本加载装置具体包括判断单元 12、脚本引用代码获取 单元 13和代码执行单元 14。判断单元 12用于当接收到携带有调用方法的方法 名称的业务逻辑功能触发请求时, 判断脚本存储单元 11中是否存在所述调用 方法对应的脚本。脚本引用代码获取单元 13用于若所述脚本存储单元 11中不 存在所述脚本, 则根据所述方法名称获取所述调用方法对应的脚本引用代 码, 代码执行单元 14用于执行所述脚本引用代码, 执行所述脚本引用代码, 下载并解析所述脚本引用代码对应的脚本, 执行所述脚本中的所述调用方
法。
本实施例提供的脚本加载装置,判断单元 12当接收到携带有调用方法的 方法名称的业务逻辑功能触发请求时, 判断脚本存储单元 11中是否存在所述 调用方法对应的脚本。 若所述脚本存储单元 11中不存在所述脚本, 脚本引用 代码获取单元 13则根据所述方法名称获取所述调用方法对应的脚本引用代 码, 代码执行单元 14执行所述脚本引用代码, 执行所述脚本引用代码, 下载 并解析所述脚本引用代码对应的脚本, 执行所述脚本中的所述调用方法。 通 过判断单元 12、 脚本引用代码获取单元 13和代码执行单元 14的设置, 以获取 调用方法对应的脚本引用代码的方式, 通过执行该脚本引用代码最终实现调 用方法的执行, 避免了在 Web应用程序开发时就在网页的初始脚本中预留回 调函数的入口, 且需明确指定需要惰性加载哪个脚本, 而造成的前后台的约 定性和耦合性较高的缺陷, 提高了 Web应用开发的通用性和灵活性。
实施例五
图 5为本发明实施例五提供的脚本加载装置结构示意图。 如图 5所示, 本 实施例提供的脚本加载装置在图 4所述实施例的基础上, 所述脚本引用代码 获取单元 13具体可以包括查找子单元 131和代码获取子单元 132。查找子单元 131用于若所述脚本存储单元 11中不存在所述脚本, 则根据所述方法名称对 源文件中的代码进行查找。 代码获取子单元 132用于若所述源文件中存在与 所述方法名称相匹配的脚本引用代码, 则获取所述脚本引用代码。 通过查找 子单元 131和代码获取子单元 132的设置, 可以从页面的源文件中获取该脚本 引用代码, 提高了脚本引用代码获取的便捷性。
在本实施例中, 该脚本加载装置具体还可以包括源文件执行单元 15, 源
文件执行单元 15用于当接收到页面加载请求时,执行所述页面加载请求对应 的页面的源文件中的代码, 其中, 若识别到所述源文件的脚本引用代码中包 含有用以指示惰性加载的标识时, 跳过所述脚本引用代码。 通过在脚本引用 代码中设置标识以指示惰性加载, 在网页开发时就可以将该脚本引用代码记 录在源文件中, 为后续的脚本引用代码的获取提供方便。
在本实施例中,所述源文件执行单元 15还用于若识别到所述源文件的脚 本引用代码中不包含用以指示惰性加载的所述标识时,执行所述脚本引用代 码, 下载所述脚本引用代码对应的脚本, 并将所述脚本存储在所述脚本存储 单元 11中。 在初始的页面加载操作中, 若识别到脚本引用代码中不包含用以 指示惰性加载的标识,则下载该脚本,并将该脚本存储在脚本存储单元 11中, 以便当业务逻辑功能触发调用该脚本中的调用方法时, 可以对脚本存储单元
11进行查找以获取相应的脚本。
实施例六
图 6为本发明实施例六提供的脚本加载装置结构示意图。 如图 6所示, 本 实施例提供的脚本加载装置在图 4所述的实施例的基础上, 所述脚本引用代 码获取单元 13具体可以包括映射表获取子单元 133、脚本信息获取子单元 134 和代码构建子单元 135。映射表获取子单元 133用于若所述脚本存储单元中不 存在所述脚本, 则获取映射表, 其中, 所述映射表中存储有所述方法名称与 所述脚本的脚本信息的映射关系, 所述脚本信息包括脚本名称和存储路径。 脚本信息获取子单元 134用于根据所述方法名称对所述映射表进行查找, 获 取所述方法名称对应的脚本信息。 代码构建子单元 135用于根据所述脚本信 息构建所述脚本引用代码。
若源文件中不存在该脚本引用代码, 可以通过构建脚本引用代码的方式 来获得该脚本引用代码。 或者, 若网页开发约定的形式即为不在源文件中记 录惰性加载的脚本对应的脚本引用代码, 也可以通过构建脚本引用代码的方 式来获得该脚本引用代码。
本发明实施例提供的脚本加载方法及装置, 当接收到携带有调用方法的 方法名称的业务逻辑功能触发请求时, 判断脚本存储单元中是否存在该调用 方法对应的脚本, 若不存在, 则根据该方法名称获取调用方法对应的脚本引 用代码。 再执行该脚本引用代码, 下载并解析脚本引用代码对应的脚本, 执 行该脚本中的调用方法。 由于浏览器是以获取调用方法对应的脚本引用代码 的方式, 通过执行该脚本引用代码最终实现调用方法的执行, 避免了在 Web 应用程序开发时就在网页的初始脚本中预留回调函数的入口, 且需明确指定 需要惰性加载哪个脚本, 而造成的前后台的约定性和耦合性较高的缺陷, 提 高了 Web应用开发的通用性和灵活性。针对于硬件资源相对有限的移动终端, 可以采用本实施例提供的技术方案来实现对脚本的惰性加载,在实现复杂的 Web应用的基础上, 避免系统资源的浪费和网络带宽的消耗。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分歩骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计算机可读 取存储介质中, 该程序在执行时, 执行包括上述方法实施例的歩骤; 而前述 的存储介质包括: R0M、 RAM, 磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其 限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或
者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应 术方案的本质脱离本发明各实施例技术方案的范围,
Claims
1、 一种脚本加载方法, 包括:
接收携带有调用方法的方法名称的业务逻辑功能触发请求, 判断脚本存 储单元中不存在所述调用方法对应的脚本;
基于所述判断的所述脚本存储单元中不存在所述脚本, 根据所述方法名 称获取所述调用方法对应的脚本引用代码;
执行所述脚本引用代码, 下载并解析所述脚本引用代码对应的脚本, 执 行所述脚本中的所述调用方法。
2、 根据权利要求 1所述的脚本加载方法, 所述根据所述方法名称获取所 述调用方法对应的脚本引用代码, 包括:
基于所述判断的所述脚本存储单元中不存在所述脚本, 根据所述方法名 称对源文件中的代码进行查找;
若所述源文件中存在与所述方法名称相匹配的脚本引用代码, 则获取所 述脚本引用代码。
3、 根据权利要求 1或 2所述的脚本加载方法, 所述接收到携带有调用方 法的方法名称的业务逻辑功能触发请求之前, 还包括:
接收到页面加载请求,执行所述页面加载请求对应的页面的源文件中的 代码, 其中, 若识别到所述源文件的脚本引用代码中包含有用以指示惰性加 载的标识时, 跳过所述脚本引用代码。
4、 根据权利要求 3所述的脚本加载方法, 所述执行所述页面加载请求对 应的页面的源文件中的代码, 还包括: 若识别到所述源文件的脚本引用代码中不包含用以指示惰性加载的所 述标识时, 执行所述脚本引用代码, 下载所述脚本引用代码对应的脚本, 并 将所述脚本存储在所述脚本存储单元中。
5、 根据权利要求 1所述的脚本加载方法, 所述根据所述方法名称获取所 述调用方法对应的脚本引用代码, 包括:
基于所述脚本存储单元中不存在所述脚本, 获取映射表, 其中, 所述映 射表中存储有所述方法名称与所述脚本的脚本信息的映射关系,所述脚本信 息包括脚本名称和存储路径;
根据所述方法名称对所述映射表进行查找, 获取所述方法名称对应的脚本信 息;
根据所述脚本信息构建所述脚本引用代码。
6、 一种脚本加载装置, 包括:
判断单元,用于接收携带有调用方法的方法名称的业务逻辑功能触发请 求, 判断脚本存储单元中不存在所述调用方法对应的脚本; 触发脚本引用代 码获取单元;
所述脚本引用代码获取单元,用于基于所述脚本存储单元中不存在所述 脚本, 根据所述方法名称获取所述调用方法对应的脚本引用代码并触发代码 执行单元;
所述代码执行单元, 用于执行所述脚本引用代码, 执行所述脚本引用代 码, 下载并解析所述脚本引用代码对应的脚本, 执行所述脚本中的所述调用 方法。
7、 根据权利要求 6所述的脚本加载装置, 所述脚本引用代码获取单元包 括:
查找子单元, 用于基于所述脚本存储单元中不存在所述脚本, 根据所述 方法名称对源文件中的代码进行查找;
代码获取子单元,用于基于所述源文件中存在与所述方法名称相匹配的 脚本引用代码, 获取所述脚本引用代码。
8、 根据权利要求 6或 7所述的脚本加载装置, 还包括:
源文件执行单元, 用于接收页面加载请求, 执行所述页面加载请求对应 的页面的源文件中的代码, 其中, 基于识别到所述源文件的脚本引用代码中 包含有用以指示惰性加载的标识, 跳过所述脚本引用代码。
9、 根据权利要求 8所述的脚本加载装置, 其特征在于: 所述源文件执行 单元还用于基于识别到所述源文件的脚本引用代码中不包含用以指示惰性 加载的所述标识, 执行所述脚本引用代码, 下载所述脚本引用代码对应的脚 本, 并将所述脚本存储在所述脚本存储单元中。
10、 根据权利要求 6所述的脚本加载装置, 所述脚本引用代码获取单元 包括:
映射表获取子单元, 用于基于所述脚本存储单元中不存在所述脚本, 获 取映射表, 其中, 所述映射表中存储有所述方法名称与所述脚本的脚本信息 的映射关系, 所述脚本信息包括脚本名称和存储路径;
脚本信息获取子单元, 用于根据所述方法名称对所述映射表进行查找, 获取所述方法名称对应的脚本信息 ·'
代码构建子单元, 用于根据所述脚本信息构建所述脚本引用代码。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110446680.6 | 2011-12-28 | ||
CN201110446680.6A CN102567516B (zh) | 2011-12-28 | 2011-12-28 | 脚本加载方法及装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2013097592A1 true WO2013097592A1 (zh) | 2013-07-04 |
Family
ID=46412915
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2012/086247 WO2013097592A1 (zh) | 2011-12-28 | 2012-12-10 | 脚本加载技术 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN102567516B (zh) |
WO (1) | WO2013097592A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11698799B2 (en) * | 2021-01-21 | 2023-07-11 | Vmware, Inc. | Lazy loading of code containers based on invoked actions in applications |
Families Citing this family (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102567516B (zh) * | 2011-12-28 | 2014-01-01 | 华为技术有限公司 | 脚本加载方法及装置 |
CN103019867B (zh) * | 2012-12-25 | 2016-06-01 | 北京奇虎科技有限公司 | 进程间的脚本执行方法、系统及浏览器 |
CN103034503B (zh) * | 2012-12-25 | 2016-07-06 | 北京奇虎科技有限公司 | 一种脚本执行方法、系统及浏览器 |
CN103150363A (zh) * | 2013-03-04 | 2013-06-12 | 北京小米科技有限责任公司 | 访问网页的方法及装置 |
CN105955980B (zh) * | 2013-05-31 | 2019-12-20 | 北京奇虎科技有限公司 | 一种文件下载设备和方法 |
CN104253783A (zh) * | 2013-06-25 | 2014-12-31 | 中国移动通信集团公司 | web应用实现代码加载方法、装置、系统及服务器 |
CN103458037A (zh) * | 2013-09-06 | 2013-12-18 | 南京南自信息技术有限公司 | 一种在资源受限环境下提供复杂网页应用的方法和设备 |
CN104573412B (zh) * | 2013-10-16 | 2019-04-23 | 航天信息软件技术有限公司 | 防止拷贝网页文字内容的方法和装置 |
CN103577227B (zh) * | 2013-10-25 | 2017-01-18 | 北京奇虎科技有限公司 | 一种加载插件的方法、浏览器和服务器 |
CN103701641B (zh) * | 2013-12-19 | 2018-03-02 | 迈普通信技术股份有限公司 | 一种自动化运维的方法和系统 |
CN106155656B (zh) * | 2015-04-07 | 2021-05-11 | 腾讯科技(深圳)有限公司 | 互联网页面组件调用的方法和装置 |
CN107528714B (zh) * | 2016-06-22 | 2023-01-20 | 中兴通讯股份有限公司 | 脚本处理方法、装置、系统及路由器 |
CN106294777A (zh) * | 2016-08-12 | 2017-01-04 | 福建天晴数码有限公司 | 浏览器脚本的缓存方法及系统 |
CN108287704A (zh) * | 2017-01-10 | 2018-07-17 | 北大方正集团有限公司 | web前端开发项目搭建的方法及系统 |
CN107102872A (zh) * | 2017-03-30 | 2017-08-29 | 北京小米移动软件有限公司 | JavaScript库的加载方法及装置 |
CN109948025B (zh) * | 2019-03-20 | 2023-10-20 | 上海古鳌电子科技股份有限公司 | 一种数据引用记录方法 |
CN110694269B (zh) * | 2019-09-27 | 2022-12-16 | 网易(杭州)网络有限公司 | 一种脚本文件的加载方法、装置、电子设备及存储介质 |
CN112699044B (zh) * | 2021-01-05 | 2023-02-24 | 长沙市到家悠享家政服务有限公司 | 压力测试方法、设备及存储介质 |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090106257A1 (en) * | 2007-10-18 | 2009-04-23 | Adaptiveblue Inc. | Multiple-link shortcuts based on contextual analysis of web page objects |
CN102567516A (zh) * | 2011-12-28 | 2012-07-11 | 华为技术有限公司 | 脚本加载方法及装置 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7689665B2 (en) * | 2007-04-27 | 2010-03-30 | Microsoft Corporation | Dynamically loading scripts |
CN101599015B (zh) * | 2009-07-07 | 2013-07-03 | 阿里巴巴集团控股有限公司 | 一种组件解析的方法和系统 |
CN101770502A (zh) * | 2009-12-30 | 2010-07-07 | 深圳市同洲电子股份有限公司 | 一种脚本处理的方法、装置和嵌入式浏览器 |
US20110239108A1 (en) * | 2010-03-26 | 2011-09-29 | Microsoft Corporation | Configurable dynamic combination of html resources for download optimization in script based web page |
-
2011
- 2011-12-28 CN CN201110446680.6A patent/CN102567516B/zh active Active
-
2012
- 2012-12-10 WO PCT/CN2012/086247 patent/WO2013097592A1/zh active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090106257A1 (en) * | 2007-10-18 | 2009-04-23 | Adaptiveblue Inc. | Multiple-link shortcuts based on contextual analysis of web page objects |
CN102567516A (zh) * | 2011-12-28 | 2012-07-11 | 华为技术有限公司 | 脚本加载方法及装置 |
Non-Patent Citations (1)
Title |
---|
YANG, FENG ET AL.: "Research on the Performance Improvement of the AJAX Technology", COMPUTER ENGINEERING & SCIENCE, vol. 30, no. 6, June 2008 (2008-06-01), pages 148 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11698799B2 (en) * | 2021-01-21 | 2023-07-11 | Vmware, Inc. | Lazy loading of code containers based on invoked actions in applications |
Also Published As
Publication number | Publication date |
---|---|
CN102567516B (zh) | 2014-01-01 |
CN102567516A (zh) | 2012-07-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2013097592A1 (zh) | 脚本加载技术 | |
WO2021139127A1 (zh) | 小程序的运行方法、装置、电子设备和存储介质 | |
US10027742B2 (en) | Techniques for sharing application states | |
WO2016192556A1 (zh) | 接口调用方法、装置及终端 | |
CN105095280B (zh) | 一种浏览器缓存方法和装置 | |
US10185704B2 (en) | Webpage browsing method, webapp framework, method and device for executing javascript and mobile terminal | |
TWI718232B (zh) | 業務執行方法及裝置 | |
WO2017113060A1 (zh) | web网站的访问方法、装置及Web网站系统 | |
CN106126693B (zh) | 一种网页的相关数据的发送方法及装置 | |
US10015226B2 (en) | Methods for making AJAX web applications bookmarkable and crawlable and devices thereof | |
CN103873918B (zh) | 图片处理方法、装置及终端 | |
WO2015014145A1 (zh) | 加快子资源加载速度的方法和装置 | |
WO2014044103A1 (zh) | 离线缓存方法及装置 | |
US8065617B2 (en) | Discovering alternative user experiences for websites | |
TW201804323A (zh) | 透過移動瀏覽器喚醒app應用的方法及裝置 | |
CN106656920B (zh) | Http服务的处理方法、装置、存储介质及处理器 | |
CN109240697B (zh) | 调用处理方法及装置、存储介质 | |
WO2012155678A1 (zh) | 基于浏览器解析方式的手机应用界面的开发方法和终端 | |
WO2022144016A1 (zh) | 应用程序控制方法、装置、电子设备和存储介质 | |
US9547633B2 (en) | Methods for extending a selector application programming interface and devices thereof | |
WO2013056564A1 (zh) | 浏览器内核适配的方法和浏览器 | |
WO2013139268A1 (zh) | 离线应用的生成及调用方法、终端及系统 | |
WO2012072041A1 (zh) | 页面展示方法、系统和装置 | |
WO2016050124A1 (zh) | 网页转码方法、装置以及服务器 | |
CN101876998B (zh) | 一种实现数据编辑的方法和系统 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 12862228 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 12862228 Country of ref document: EP Kind code of ref document: A1 |