Nothing Special   »   [go: up one dir, main page]

CN102567516B - Script loading method and device - Google Patents

Script loading method and device Download PDF

Info

Publication number
CN102567516B
CN102567516B CN201110446680.6A CN201110446680A CN102567516B CN 102567516 B CN102567516 B CN 102567516B CN 201110446680 A CN201110446680 A CN 201110446680A CN 102567516 B CN102567516 B CN 102567516B
Authority
CN
China
Prior art keywords
script
reference code
storage unit
code
source file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201110446680.6A
Other languages
Chinese (zh)
Other versions
CN102567516A (en
Inventor
孙尹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingjiang Xinyi New Materials Technology Co ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201110446680.6A priority Critical patent/CN102567516B/en
Publication of CN102567516A publication Critical patent/CN102567516A/en
Priority to PCT/CN2012/086247 priority patent/WO2013097592A1/en
Application granted granted Critical
Publication of CN102567516B publication Critical patent/CN102567516B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

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

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

Script loading method and device
Technical field
The present invention relates to the communication technology, relate in particular to a kind of script loading method and device.
Background technology
Widespread use along with the internet technology, the Web technology has been widely used on internet, but early stage Web application is all static HTML (Hypertext Markup Language) (Hypertext Markup Language, HTML) page, for some text messages are presented to the viewer, these information are fixedly to write in html page, and this page does not possess the ability with user interactions, there is no the function dynamically shown.Present Web application has not been the webpage pattern of pure static state, but comprises that inquiry, the additions and deletions to information of can realizing of webpage, program, database and other data file layout change the integrated application with interactive operation.
JavaScript is a kind of script that is widely used in client Web exploitation, is commonly used to add dynamic function to html web page, such as response user's various operations.The Web application needs huge JavaScript foreground script to realize complicated logic and effect usually, download, resolve and carry out the JavaScript script and need to consume more browser performances, simultaneously, before the full dose script does not load fully, the Web application can not provide the user interactions ability at once.Huge JavaScript script can take network bandwidth resources, and not all JavaScript script can be used at once usually, and the user's that these temporary transient useless JavaScript scripts spend concentrated time and bandwidth.
For these problems, prior art provides a kind of inertia to load the method for JavaScript script, by self-defining JavaScript script, the entrance of reserved call back function in the initial script loaded on foreground, when logic of business functions needs (logic judgement or timer trigger) or user's manual triggers, ask to the server end request and download the JavaScript script of corresponding function by Ajax, carrying out again parsing operation after turning back to the foreground browser.But the method that this inertia loads need to be developed initial script, and just clearly specify and need inertia to load which backstage JavaScript script file when program development, the approximately qualitative and coupling of AM/BAM is higher, thus the versatility of Web application and development and dirigibility all poor.
Summary of the invention
The embodiment of the present invention provides a kind of script loading method and device, to improve versatility and the dirigibility of Web application and development.
The embodiment of the present invention provides a kind of script loading method, comprising:
When receiving the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that described call method is corresponding;
If do not have described script in described script storage unit, according to described method name, obtain the script reference code that described call method is corresponding;
Carry out described script reference code, download and resolve script corresponding to described script reference code, carry out the described call method in described script.
The embodiment of the present invention provides a kind of script charger, comprising:
Judging unit, for when receiving the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that described call method is corresponding;
Script reference Code obtaining unit, if do not have described script for described script storage unit, obtain according to described method name the script reference code that described call method is corresponding;
The code performance element, for carrying out described script reference code, carry out described script reference code, downloads and resolve script corresponding to described script reference code, carries out the described call method in described script.
As shown from the above technical solution, the script loading method that the embodiment of the present invention provides and device, when receiving the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that this call method is corresponding, if do not exist, the corresponding script reference code according to the method name acquiring call method.Carry out again this script reference code, download and resolve the script that the script reference code is corresponding, carry out the call method in this script.Because browser is the mode of obtaining the script reference code that call method is corresponding, finally realize the execution of call method by carrying out this script reference code, avoided just reserving the entrance of call back function in the initial script of webpage when web application is developed, and need clearly specify and need inertia to load which script, and the approximately qualitative and higher defect of coupling of the AM/BAM caused has improved versatility and the dirigibility of Web application and development.
The accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, below will the accompanying drawing of required use in embodiment or description of the Prior Art be briefly described, apparently, accompanying drawing in the following describes is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain according to these accompanying drawings other accompanying drawing.
The script loading method process flow diagram that Fig. 1 provides for the embodiment of the present invention one;
The script loading method process flow diagram that Fig. 2 provides for the embodiment of the present invention two;
The script loading method process flow diagram that Fig. 3 provides for the embodiment of the present invention three;
The script charger structural representation that Fig. 4 provides for the embodiment of the present invention four;
The script charger structural representation that Fig. 5 provides for the embodiment of the present invention five;
The script charger structural representation that Fig. 6 provides for the embodiment of the present invention six.
Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the present invention clearer, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making under the creative work prerequisite the every other embodiment obtained, belong to the scope of protection of the invention.
The user carrys out browsing page by browser usually, and browser receives page load request, loads webpage corresponding to this page load request, carries out the source file of webpage.Source file is generally the code that HTML writes, and in source file, can embed the script reference code, to realize the loading to script.It is a kind of pattern in the Web exploitation that inertia loads (Lazy Loading), and under default situations, partial page data or script do not download to browser, when user's triggering or application logic triggering, then downloads the data of response to server request.Inertia by script loads, and can when needs be carried out script, again this script be downloaded and carry out, and avoids taking of Internet resources bandwidth.
Embodiment mono-
The script loading method process flow diagram that Fig. 1 provides for the embodiment of the present invention one.As shown in Figure 1, the script loading method that the present embodiment provides specifically can be applied to script loading processing process, especially can be applied to the processing procedure of browser to the script of inertia loading, and script is specifically as follows the JavaScript script.The script loading method that the present embodiment provides can be carried out by the script charger, in this charger, can be provided with browser, can realize by the mode of software and hardware.When the user passes through the browser browsing page, browser receives page load request, Web page loading, the source file of execution webpage.If it is that inertia loads that the programmer arranges partial page data and the script of this webpage in the webpage development process, in initial webpage loading procedure, browser only will need web data and the script downloaded at once to download to this locality, be stored in the script storage unit, and the page data and the script that these are not needed inertia to load download to this locality.The script storage unit specifically can be arranged in this charger and also can arrange separately.
In the process of the source file of browser execution webpage, service logic judgement in webpage triggers or clocked flip, during perhaps by the manual clicking trigger of user, need to call the call method of realizing this function in realizing the process of certain function, this call method is specifically as follows a function, browser generates the logic of business functions trigger request of calling this call method in order to indication, carries the method name of this call method in this logic of business functions trigger request.
The script loading method that the present embodiment provides specifically comprises:
Step 10, when the script charger receives the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that described call method is corresponding.
Concrete, call method is recorded in script usually, at first according to method name, the script of storing in the script storage unit is inquired about, judge in the script storage unit and whether have the script that this call method is corresponding, if there is this script in this script storage unit, illustrate that script that this call method is corresponding has downloaded to the script storage unit in initial page loading procedure.This script is resolved, carried out the call method in script, to realize corresponding function.If do not have this script in this script storage unit, illustrate that the script that this call method is corresponding is the script that inertia loads, this script is not also downloaded and is stored in the script storage unit.
If do not have described script in the described script storage unit of step 20, this script charger obtains according to described method name the script reference code that described call method is corresponding;
If there is not this script in the script storage unit, the corresponding script reference code according to this call method of the method name acquiring.The script reference code is specially one section code, by carrying out this code, and can be to download and the execution that realizes this script.This script reference code can obtain the source file corresponding from webpage, also can generate according to the method title, the mapping relations table of all right method to set up title and script reference code, with according to the method name acquiring script reference code, the concrete obtain manner of script reference code is not limited with the present embodiment.
Step 30, carry out described script reference code, download and resolve script corresponding to described script reference code, carry out the described call method in described script.
Browser is carried out this script reference code, downloads and resolve the script that the script reference code is corresponding.Specifically can obtain this script by the mode that sends HTML (Hypertext Markup Language) (Hyper Text Transfer Protocol is called for short HTTP) request to server.Carry out the call method in this script, and show execution result to the user, to realize corresponding logic of business functions.
Below take the implementation procedure of the script loading method that the JavaScript script provides the present embodiment as example and elaborate:
The user is by the browser browsing page, and browser is carried out the source file of webpage, downloading web pages data and script, and script is stored in the script storage unit.When user's clicking trigger service logic need to be called call method com.huawei.iread.helloWord (), generate the logic of business functions trigger request.Carry the method name of call method in this logic of business functions trigger request, for com.huawei.iread.helloWord, according to naming rule, the script that records the JavaScript script of this call method is com.huawei.iread.js, the title that the character field com.huawei.iread except last character section of method name is the JavaScript script that call method is corresponding.According to the method title, the script of storing in the script storage unit is inquired about, if there is not this JavaScript script in the script storage unit, the corresponding script reference code according to this call method of the method name acquiring.
Particularly, the script reference code can pass through the JavaScript script of the mode quote server end of Script mark.Concrete form is as follows:
<script?type=″text/javascript″src=″../script/com.huawei.iread.js″>
Wherein, in the Script mark, the type attribute is in order to indicate the mime type of script.The URL(uniform resource locator) (Uniform/Universal Resource Locator be called for short URL) of src attribute in order to indicate external scripts.Com.huawei.iread.js is the JavaScript script that call method is corresponding, the store path that URL is this JavaScript script.
Browser is carried out this script reference code, downloads and resolve JavaScript script com.huawei.iread.js, carries out call method com.huawei.iread.helloWord ().
The script loading method that the present embodiment provides, when receiving the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that this call method is corresponding, if do not exist, the corresponding script reference code according to the method name acquiring call method.Carry out again this script reference code, download and resolve the script that the script reference code is corresponding, carry out the call method in this script.Because browser is the mode of obtaining the script reference code that call method is corresponding, finally realize the execution of call method by carrying out this script reference code, avoided just reserving the entrance of call back function in the initial script of webpage when web application is developed, and need clearly specify and need inertia to load which script, and the approximately qualitative and higher defect of coupling of the AM/BAM caused has improved versatility and the dirigibility of Web application and development.
Embodiment bis-
The script loading method process flow diagram that Fig. 2 provides for the embodiment of the present invention two.As shown in Figure 2, the script loading method that the present embodiment provides is on the basis of the described embodiment of Fig. 1, and preferably, script reference code corresponding to script that inertia loads can be recorded in the source file of webpage.The script of in this script reference code, by the mode that sign is set, indicating this script reference code to quote is that inertia loads.
For example, take the JavaScript script as example, can realize by the mode of expansion Script mark additional information the inertia of JavaScript script is loaded.Can define the defer attribute in the Script mark, the defer attribute is in order to indicate whether that execution is postponed to script, until the page loads.Include the defer attribute in the script reference code, and the value of defer attribute is " defer ", downloads this script in the process loaded at the page, but do not carry out immediately this script, until page loaded is just carried out this script.Can preset when the value of defer attribute is other values except " defer ", the indication inertia loads this script.This script reference code is specifically as follows:
<script?type=″text/javascript″defer=″a″src=″../script/com.huawei.iread.js″>
In the present embodiment, step 10, when receiving the logic of business functions trigger request of the method name that carries call method, before judging in the script storage unit and whether having the script that described call method is corresponding, specifically can also comprise the steps:
Step 40, when receiving page load request, carry out the code in the source file of the page corresponding to described page load request, wherein, during the sign that includes if recognize in the script reference code of described source file to indicate inertia to load, skip described script reference code.
The request of the request browser Web page loading page generated when page load request is the user and browses web sites by browser.When browser receives page load request, carry out the code in the source file of the page corresponding to this page load request, carry out initial page load operation.In the implementation of code, include the sign of indicating inertia to load if recognize in the script reference code, as defer=" a ", illustrate that the script in this script reference code needs inertia to load, skip this script reference code and do not carry out.By being set in the script reference code, sign loads with the indication inertia, and just can be by this script reference code record in source file, for follow-up obtaining of script reference code provided convenience when webpage development.
In the present embodiment, carry out the code in the source file of the page corresponding to described page load request, specifically can also comprise the steps:
During the described sign that do not comprise if recognize in the script reference code of described source file to indicate inertia to load, carry out described script reference code, download script corresponding to described script reference code, and described script is stored in described script storage unit.
In initial page load operation, do not comprise the sign of indicating inertia to load if recognize in the script reference code, illustrate that the script that this script reference code is corresponding can download at once, download this script, and this script is stored in the script storage unit, while with convenient logic of business functions triggering, calling the call method in this script, can be searched to obtain corresponding script to the script storage unit.
Step 20, if do not have described script in described script storage unit, obtain according to described method name the script reference code that described call method is corresponding, specifically can comprise the steps:
If do not have described script in the described script storage unit of step 201, according to described method name, the code in source file searched;
If have the script reference code be complementary with described method name in the described source file of step 202, obtain described script reference code.
In above-mentioned embodiment, script reference code record corresponding to the script that inertia loads, in the source file of webpage, but do not carried out this script reference code in the original upload of the page.While not having script corresponding to the call method that need call in the script storage unit, can to the code in source file, be searched according to the method name of this call method, to obtain the script reference code that this script is corresponding.
Embodiment tri-
The script loading method process flow diagram that Fig. 3 provides for the embodiment of the present invention three.As shown in Figure 3, the script loading method that the present embodiment provides, step 20, if do not have described script in described script storage unit, obtain according to described method name the script reference code that described call method is corresponding, specifically can comprise the steps:
If do not have described script in the described script storage unit of step 203, obtain mapping table, wherein, store the mapping relations of the script information of described method name and described script in described mapping table, described script information comprises script name and store path;
In the source file of webpage, also can indicate by other means inertia to load, as do not recorded script reference code corresponding to script that needs inertia to load in source file.Owing to there not being this script reference code in source file,, in initial page loading procedure, this script reference code is not performed, and can realize the inertia of script is loaded, and the method realizes simple.
While not having this script reference code in source file, obtain mapping table.Store the mapping relations of the script information of method name and script in this mapping table, this script information comprises script name and store path.For example method name is com.huawei.iread.helloWord, corresponding with script name com.huawei.iread and store path ../script/.
Step 204, according to described method name, described mapping table is searched, obtained script information corresponding to described method name;
Step 205, according to described script information, build described script reference code.
Can get the script information of script according to method name, again because script information has comprised script name and store path, can build the script reference code according to script name and store path.
It should be noted that in the present embodiment, can, according to making an appointment, by the mode that builds the script reference code according to script information, obtain this script reference code.Also can at first according to method name, to source file, be inquired about, during the method title is complementary if be present in source file script reference code, by perform step 201 and step 202 realize obtaining of script reference code, if, while not having the script reference code be complementary with method name in source file, the method that can provide by the present embodiment is obtained the script reference code.
Embodiment tetra-
The script charger structural representation that Fig. 4 provides for the embodiment of the present invention four.As shown in Figure 4, the script charger that the present embodiment provides specifically can be realized each step of the script loading method that any embodiment of the present invention provides, and this repeats no more.
The script charger that the present embodiment provides specifically comprises judging unit 12, script reference Code obtaining unit 13 and code performance element 14.Judging unit 12, for when receiving the logic of business functions trigger request of the method name that carries call method, judges in script storage unit 11 and whether has the script that described call method is corresponding.If there is not described script in script reference Code obtaining unit 13 for described script storage unit 11, according to described method name, obtain the script reference code that described call method is corresponding, code performance element 14 is for carrying out described script reference code, carry out described script reference code, download and resolve script corresponding to described script reference code, carry out the described call method in described script.
The script charger that the present embodiment provides, judging unit 12, when receiving the logic of business functions trigger request of the method name that carries call method, judges in script storage unit 11 and whether has the script that described call method is corresponding.If do not have described script in described script storage unit 11,13 of script reference Code obtaining unit obtain according to described method name the script reference code that described call method is corresponding, code performance element 14 is carried out described script reference code, carry out described script reference code, download and resolve script corresponding to described script reference code, carry out the described call method in described script.Setting by judging unit 12, script reference Code obtaining unit 13 and code performance element 14, to obtain the mode of the script reference code that call method is corresponding, finally realize the execution of call method by carrying out this script reference code, avoided just reserving the entrance of call back function in the initial script of webpage when web application is developed, and need clearly specify and need inertia to load which script, and the approximately qualitative and higher defect of coupling of the AM/BAM caused has improved versatility and the dirigibility of Web application and development.
Embodiment five
The script charger structural representation that Fig. 5 provides for the embodiment of the present invention five.As shown in Figure 5, the script charger that the present embodiment provides is on the basis of the described embodiment of Fig. 4, and described script reference Code obtaining unit 13 specifically can comprise searches subelement 131 and Code obtaining subelement 132.There do not is described script if search subelement 131 for described script storage unit 11, according to described method name, the code in source file is searched.If there is the script reference code be complementary with described method name in Code obtaining subelement 132 for described source file, obtain described script reference code.By searching the setting of subelement 131 and Code obtaining subelement 132, can from the source file of the page, obtain this script reference code, improved the convenience of script reference Code obtaining.
In the present embodiment, this script charger specifically can also comprise source file performance element 15, source file performance element 15 is for when receiving page load request, carry out the code in the source file of the page corresponding to described page load request, wherein, during the sign that includes if recognize in the script reference code of described source file to indicate inertia to load, skip described script reference code.By being set in the script reference code, sign loads with the indication inertia, and just can be by this script reference code record in source file, for follow-up obtaining of script reference code provided convenience when webpage development.
In the present embodiment, when if described source file performance element 15 does not also comprise to indicate the described sign of inertia loading for the script reference code that recognizes described source file, carry out described script reference code, download script corresponding to described script reference code, and described script is stored in described script storage unit 11.In initial page load operation, do not comprise the sign of indicating inertia to load if recognize in the script reference code, download this script, and this script is stored in script storage unit 11, while with convenient logic of business functions triggering, calling the call method in this script, can be searched to obtain corresponding script to script storage unit 11.
Embodiment six
The script charger structural representation that Fig. 6 provides for the embodiment of the present invention six.As shown in Figure 6, the script charger that the present embodiment provides is on the basis of the described embodiment of Fig. 4, and described script reference Code obtaining unit 13 specifically can comprise that mapping table obtains subelement 133, script information obtains subelement 134 and code construction subelement 135.If mapping table obtains subelement 133 and does not have described script for described script storage unit, obtain mapping table, wherein, store the mapping relations of the script information of described method name and described script in described mapping table, described script information comprises script name and store path.Script information obtains subelement 134 for according to described method name, described mapping table being searched, and obtains script information corresponding to described method name.Code construction subelement 135 is for building described script reference code according to described script information.
If there is not this script reference code in source file, can obtain this script reference code by the mode that builds the script reference code.Perhaps, if the form of webpage development agreement is, in source file, do not record script reference code corresponding to script that inertia loads, also can obtain this script reference code by the mode that builds the script reference code.
The script loading method that the embodiment of the present invention provides and device, when receiving the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that this call method is corresponding, if do not exist, the corresponding script reference code according to the method name acquiring call method.Carry out again this script reference code, download and resolve the script that the script reference code is corresponding, carry out the call method in this script.Because browser is the mode of obtaining the script reference code that call method is corresponding, finally realize the execution of call method by carrying out this script reference code, avoided just reserving the entrance of call back function in the initial script of webpage when web application is developed, and need clearly specify and need inertia to load which script, and the approximately qualitative and higher defect of coupling of the AM/BAM caused has improved versatility and the dirigibility of Web application and development.Be directed to the relatively limited mobile terminal of hardware resource, the technical scheme that can adopt the present embodiment to provide realizes the inertia of script is loaded, and on the basis of realizing complicated Web application, avoids the waste of system resource and the consumption of the network bandwidth.
One of ordinary skill in the art will appreciate that: realize that the hardware that all or part of step of said method embodiment can be relevant by programmed instruction completes, aforesaid program can be stored in a computer read/write memory medium, this program, when carrying out, is carried out the step that comprises said method embodiment; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CDs.
Finally it should be noted that: above embodiment only, in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment, the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: its technical scheme that still can put down in writing aforementioned each embodiment is modified, or part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the scope of various embodiments of the present invention technical scheme.

Claims (10)

1. a script loading method, is characterized in that, comprising:
When receiving the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that described call method is corresponding;
If do not have described script in described script storage unit, according to described method name, obtain the script reference code that described call method is corresponding;
Carry out described script reference code, download and resolve script corresponding to described script reference code, carry out the described call method in described script.
2. script loading method according to claim 1, is characterized in that, if do not have described script in described script storage unit, according to described method name, obtains the script reference code that described call method is corresponding, comprising:
If do not have described script in described script storage unit, according to described method name, the code in source file searched;
If have the script reference code be complementary with described method name in described source file, obtain described script reference code.
3. script loading method according to claim 1 and 2, it is characterized in that, when receiving the logic of business functions trigger request of the method name that carries call method, before judging in the script storage unit and whether having the script that described call method is corresponding, also comprise:
When receiving page load request, carry out the code in the source file of the page corresponding to described page load request, wherein, during the sign that includes if recognize in the script reference code of described source file to indicate inertia to load, skip described script reference code.
4. script loading method according to claim 3, is characterized in that, the code in the source file of the page that the described page load request of described execution is corresponding also comprises:
During the described sign that do not comprise if recognize in the script reference code of described source file to indicate inertia to load, carry out described script reference code, download script corresponding to described script reference code, and described script is stored in described script storage unit.
5. script loading method according to claim 1, is characterized in that, if do not have described script in described script storage unit, according to described method name, obtains the script reference code that described call method is corresponding, comprising:
If do not have described script in described script storage unit, obtain mapping table, wherein, store the mapping relations of the script information of described method name and described script in described mapping table, described script information comprises script name and store path;
According to described method name, described mapping table is searched, obtained script information corresponding to described method name;
Build described script reference code according to described script information.
6. a script charger, is characterized in that, comprising:
Judging unit, for when receiving the logic of business functions trigger request of the method name that carries call method, judge in the script storage unit and whether have the script that described call method is corresponding;
Script reference Code obtaining unit, if do not have described script for described script storage unit, obtain according to described method name the script reference code that described call method is corresponding;
The code performance element, for carrying out described script reference code, carry out described script reference code, downloads and resolve script corresponding to described script reference code, carries out the described call method in described script.
7. script charger according to claim 6, is characterized in that, described script reference Code obtaining unit comprises:
Search subelement, if do not have described script for described script storage unit, according to described method name, the code in source file is searched;
The Code obtaining subelement, if there is the script reference code be complementary with described method name for described source file, obtain described script reference code.
8. according to the described script charger of claim 6 or 7, it is characterized in that, also comprise:
The source file performance element, for when receiving page load request, carry out the code in the source file of the page corresponding to described page load request, wherein, during the sign that includes if recognize in the script reference code of described source file to indicate inertia to load, skip described script reference code.
9. script charger according to claim 8, it is characterized in that: if when described source file performance element does not also comprise to indicate the described sign of inertia loading for the script reference code that recognizes described source file, carry out described script reference code, download script corresponding to described script reference code, and described script is stored in described script storage unit.
10. script charger according to claim 6, is characterized in that, described script reference Code obtaining unit comprises:
Mapping table obtains subelement, if do not have described script for described script storage unit, obtain mapping table, wherein, store the mapping relations of the script information of described method name and described script in described mapping table, described script information comprises script name and store path;
Script information obtains subelement, for according to described method name, described mapping table being searched, obtains script information corresponding to described method name;
The code construction subelement, for building described script reference code according to described script information.
CN201110446680.6A 2011-12-28 2011-12-28 Script loading method and device Active CN102567516B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201110446680.6A CN102567516B (en) 2011-12-28 2011-12-28 Script loading method and device
PCT/CN2012/086247 WO2013097592A1 (en) 2011-12-28 2012-12-10 Script loading technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110446680.6A CN102567516B (en) 2011-12-28 2011-12-28 Script loading method and device

Publications (2)

Publication Number Publication Date
CN102567516A CN102567516A (en) 2012-07-11
CN102567516B true CN102567516B (en) 2014-01-01

Family

ID=46412915

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110446680.6A Active CN102567516B (en) 2011-12-28 2011-12-28 Script loading method and device

Country Status (2)

Country Link
CN (1) CN102567516B (en)
WO (1) WO2013097592A1 (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567516B (en) * 2011-12-28 2014-01-01 华为技术有限公司 Script loading method and device
CN103034503B (en) * 2012-12-25 2016-07-06 北京奇虎科技有限公司 A kind of script execution, system and browser
CN103019867B (en) * 2012-12-25 2016-06-01 北京奇虎科技有限公司 Script execution between process, system and browser
CN103150363A (en) * 2013-03-04 2013-06-12 北京小米科技有限责任公司 Method and device for accessing web pages
CN105955980B (en) * 2013-05-31 2019-12-20 北京奇虎科技有限公司 File downloading device and method
CN104253783A (en) * 2013-06-25 2014-12-31 中国移动通信集团公司 Web application realization code loading method, device, system and server
CN103458037A (en) * 2013-09-06 2013-12-18 南京南自信息技术有限公司 Method and device for providing complex web applications in resource-constrained environment
CN104573412B (en) * 2013-10-16 2019-04-23 航天信息软件技术有限公司 The method and apparatus for preventing copy webpage word content
CN103577227B (en) * 2013-10-25 2017-01-18 北京奇虎科技有限公司 Method for loading plug-ins, browser and server
CN103701641B (en) * 2013-12-19 2018-03-02 迈普通信技术股份有限公司 A kind of method and system for automating O&M
CN106155656B (en) * 2015-04-07 2021-05-11 腾讯科技(深圳)有限公司 Method and device for calling internet page component
CN107528714B (en) * 2016-06-22 2023-01-20 中兴通讯股份有限公司 Script processing method, device and system and router
CN106294777A (en) * 2016-08-12 2017-01-04 福建天晴数码有限公司 The caching method of browser script and system
CN108287704A (en) * 2017-01-10 2018-07-17 北大方正集团有限公司 The method and system that web front-end exploration project is built
CN107102872A (en) * 2017-03-30 2017-08-29 北京小米移动软件有限公司 The loading method and device in JavaScript storehouses
CN109948025B (en) * 2019-03-20 2023-10-20 上海古鳌电子科技股份有限公司 Data reference recording method
CN110694269B (en) * 2019-09-27 2022-12-16 网易(杭州)网络有限公司 Script file loading method and device, electronic equipment and storage medium
CN112699044B (en) * 2021-01-05 2023-02-24 长沙市到家悠享家政服务有限公司 Pressure testing method, equipment and storage medium
US11698799B2 (en) * 2021-01-21 2023-07-11 Vmware, Inc. Lazy loading of code containers based on invoked actions in applications

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7689665B2 (en) * 2007-04-27 2010-03-30 Microsoft Corporation Dynamically loading scripts
US20090106257A1 (en) * 2007-10-18 2009-04-23 Adaptiveblue Inc. Multiple-link shortcuts based on contextual analysis of web page objects
CN101599015B (en) * 2009-07-07 2013-07-03 阿里巴巴集团控股有限公司 Method and system for analyzing component
CN101770502A (en) * 2009-12-30 2010-07-07 深圳市同洲电子股份有限公司 Scripting method, device and embedded browser
US20110239108A1 (en) * 2010-03-26 2011-09-29 Microsoft Corporation Configurable dynamic combination of html resources for download optimization in script based web page
CN102567516B (en) * 2011-12-28 2014-01-01 华为技术有限公司 Script loading method and device

Also Published As

Publication number Publication date
WO2013097592A1 (en) 2013-07-04
CN102567516A (en) 2012-07-11

Similar Documents

Publication Publication Date Title
CN102567516B (en) Script loading method and device
CN106708899B (en) Automatic point burying method and device
US10015226B2 (en) Methods for making AJAX web applications bookmarkable and crawlable and devices thereof
US8983935B2 (en) Methods for utilizing a javascript emulator in a web content proxy server and devices thereof
CN104731589A (en) Automatic generation method and device of user interface (UI)
WO2016177341A1 (en) Interface calling method and device, and terminal
CN109829121B (en) Method and device for reporting click behavior data
CN110321503B (en) Web component caching method and device and electronic equipment
CN111639278A (en) Webpage loading method and device
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
CN108255708A (en) Method, apparatus, storage medium and the equipment of production file are accessed in test environment
CN102253986A (en) Method and device for improving webpage displaying effect in multiple terminals
CN104899217B (en) A kind of implementation method and device of custom feature
CN112087370A (en) Method, system, electronic device and computer-readable storage medium for issuing GitHub Issues
CN105701153A (en) Method and device for reading webpage resources and electronic equipment
CN101876998B (en) Method and system for editing data
CN102955852A (en) Method, device and equipment for webpage resource processing
CN114553971A (en) Application framework design method, system, device and medium
CN112214250A (en) Application program assembly loading method and device
CN104899319A (en) Webpage icon uploading method and device
CN115981650A (en) Website building method and device, electronic equipment and storage medium
CN114253441B (en) Method and device for enabling target function, storage medium and electronic device
US11843679B2 (en) Automated dependency management based on page components
CN112287266A (en) Processing method and device for webpage configuration, equipment and storage medium
CN115857914A (en) Method, equipment and storage medium for automatically generating codes

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201125

Address after: 246 Xinqiao street, Xinqiao Town, Jingjiang City, Taizhou City, Jiangsu Province

Patentee after: Jiangsu Longli Valve Manufacturing Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240205

Address after: No. 26 Xinqiao East Road, Xinqiao Town, Jingjiang City, Taizhou City, Jiangsu Province, 214500

Patentee after: Jingjiang Xinyi New Materials Technology Co.,Ltd.

Country or region after: China

Address before: 214500 No.246, Xinqiao street, Xinqiao Town, Jingjiang City, Taizhou City, Jiangsu Province

Patentee before: Jiangsu Longli Valve Manufacturing Co.,Ltd.

Country or region before: China