CN107562749A - A kind of webpage loading method and webpage loading device - Google Patents
A kind of webpage loading method and webpage loading device Download PDFInfo
- Publication number
- CN107562749A CN107562749A CN201610509349.7A CN201610509349A CN107562749A CN 107562749 A CN107562749 A CN 107562749A CN 201610509349 A CN201610509349 A CN 201610509349A CN 107562749 A CN107562749 A CN 107562749A
- Authority
- CN
- China
- Prior art keywords
- page
- script file
- public
- webpage loading
- function
- 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.)
- Pending
Links
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
This application discloses a kind of webpage loading method and webpage loading device.Webpage loading method includes first page load step:Script file is loaded, the script file includes the public script file of encapsulation;Parse and perform the script file;Determine second page forms object and the parsing after public script file corresponding relation, wherein, the second page is nested in the first page;Second page load step:According to the corresponding relation, the public script file corresponding to the forms object of the second page is determined;Perform the content of the public script file.Repeat to load and parse these public script files when the application can avoid opening sub-pages, so as to reduce page loading parsing duration, reduce user's waiting time, save Internet resources, and greatly reduce the computing resource of local computer.
Description
Technical field
The application is related to network technique field, more particularly to a kind of webpage loading method and webpage loading dress
Put.
Background technology
Many webpages are shown using iframe nestings subpage frame at present, i.e., one complete webpage by
The one female page (or parent page) composition nested with multiple subpage frames.The female page and subpage frame are required for drawing
Enter script (such as javascript) to perform specific operation, wherein each page is typically necessary introducing one
A little common resource files, such as public script file jquery script files.
Because in the presence of can not (between the i.e. female page and subpage frame, between subpage frame and subpage frame) across forms
The problem of directly using these public script files, when opening subpage frame every time, it is required for repeating loading simultaneously
Parse these public script files, so as to exist the page loading parsing time long, increase period of reservation of number,
The shortcomings of wasting Internet resources and local computer computing resource.
The content of the invention
In order to solve the above-mentioned technical problem, this application provides a kind of webpage loading method and webpage loading dress
Put, repeat to load and parse these public script files when can avoid opening sub-pages, so as to reduce page
Face loading parsing duration, reduces user's waiting time, saves Internet resources, and greatly reduce local computing
The computing resource of machine.
In order to reach the purpose of the application, this application provides a kind of webpage loading method, including:
First page load step:
Script file is loaded, the script file includes the public script file of encapsulation;
Parse and perform the script file;
Determine second page forms object and the parsing after public script file corresponding relation, its
In, the second page is nested in the first page;
Second page load step:
According to the corresponding relation, the public script corresponding to the forms object of the second page is determined
File;
Perform the content of the public script file.
Wherein, the step of second page loading also includes:Load, parse and perform the second page
Other script files in face in addition to common resource file.
Wherein, the public script file of the encapsulation is to use the function grammer in javascript to encapsulate.
Wherein, it is described to parse and perform the script file and include:
The public script file for parsing the encapsulation obtains the function for including the content of the public script file
Memory address;
Perform the content of the public script file in the function.
Wherein, it is described determine second page forms object and the parsing after public script file pair
Should be related to including:
Determine the forms object of second page;
Establish the corresponding relation of the forms object of the second page and the memory address of the function.
Wherein, the nested multiple second pages of the first page.
Present invention also provides a kind of webpage loading method, including:
First page load step:
Script file is loaded, the script file includes the public script file of encapsulation;
Parse and perform the script file;
Second page load step:
Determine second page forms object and the parsing after public script file corresponding relation, its
In, the second page is nested in the first page;
According to the corresponding relation, the public script corresponding to the forms object of the second page is determined
File;
Perform the content of the public script file.
Wherein, the step of second page loading also includes:Load, parse and perform the second page
Other script files in face in addition to common resource file.
Wherein, the public script file of the encapsulation is to use the function grammer in javascript to encapsulate.
Wherein, it is described to parse and perform the script file and include:
The public script file for parsing the encapsulation obtains the function for including the content of the public script file
Memory address;
Perform the content of the public script file in the function.
Wherein, it is described determine second page forms object and the parsing after public script file it is interior
The corresponding relation of appearance includes:
Obtain the memory address of the function for the content for including the public script file;
Establish the corresponding relation of the forms object of the second page and the memory address of the function.
Wherein, the nested multiple second pages of the first page.
Present invention also provides a kind of webpage loading device, including:
Load-on module, for loading first page and second page, wherein, the second page is nested in
In the first page;The script file in the first page is loaded, the script file includes encapsulation
Public script file;
Execution module is parsed, for the script file to be parsed and performed in the first page;
Determining module, for determine second page forms object and the parsing after public script file
Corresponding relation, and according to the corresponding relation, determine institute corresponding to the forms object of the second page
Public script file is stated, wherein, the second page is nested in the first page;
The parsing execution module is additionally operable to, and the public script file is performed in the second page
Content.
Wherein, the public script file of the encapsulation is to use the function grammer in javascript to encapsulate.
Wherein, the parsing execution module is additionally operable to, and the public affairs of the encapsulation are parsed in the first page
Script file obtains the memory address for including the function of the content of the public script file altogether, and performs
The content of public script file in the function.
Wherein, the module of establishing is additionally operable to:
In the first page, the forms object of second page is determined, and establishes the second page
The corresponding relation of the memory address of forms object and the function;Or
In the second page, with obtaining the internal memory of the function for the content for including the public script file
Location, and establish the corresponding relation of the forms object of the second page and the memory address of the function.
Wherein, the nested multiple second pages of the first page.
The webpage loading method and webpage loading device that the application provides, by the forms for establishing second page
The corresponding relation of the content of public script file after being parsed in object and first page, in loading second page
During face, without repeating to load and parsing public script file, so as to reduce page loading duration, reduce and use
Family waiting time, and greatly reduce local computer computing resource.
Other features and advantage will illustrate in the following description, also, partly from froming the perspective of
Become apparent in bright book, or understood by implementing the application.The purpose of the application is excellent with other
Point can be realized and obtained by specifically noted structure in specification, claims and accompanying drawing
.
Brief description of the drawings
Accompanying drawing is used for providing further understanding technical scheme, and one of constitution instruction
Point, the technical scheme for explaining the application is used for together with embodiments herein, is not formed to the application
The limitation of technical scheme.
Fig. 1 is the webpage schematic diagram of the application;
Fig. 2 is the flow chart of the embodiment one of the webpage loading method of the application;
Fig. 3 is the flow chart of the embodiment two of the webpage loading method of the application;
Fig. 4 is the structure chart of the embodiment of the webpage loading device of the application.
Embodiment
For the purpose, technical scheme and advantage of the application are more clearly understood, below in conjunction with accompanying drawing
Embodiments herein is described in detail.It should be noted that in the case where not conflicting, this Shen
Please in embodiment and embodiment in feature can mutually be combined.
Can be in the computer of such as one group computer executable instructions the flow of accompanying drawing illustrates the step of
Performed in system.Also, although logical order is shown in flow charts, in some cases,
Can be with the step shown or described by being performed different from order herein.
The main thought of the application includes:In order that can during the local opening webpage by APP such as browsers
Realize quick loading, by establish second page forms object and first page in parse after public pin
The corresponding relation of the content of this document, when loading second page, without repeating to load and parsing public pin
This document, so as to reduce page loading duration, user's waiting time is reduced, and greatly reduce local computing
Machine computing resource.
Fig. 1 is the webpage schematic diagram of the application.As shown in figure 1, a complete webpage is by one first
Page composition nested with one or more second pages, wherein, first page can be female page or father's page
Face, second page can be subpage frames.
Fig. 2 is the flow chart of the embodiment one of the webpage loading method of the application.As shown in Fig. 2 the net
Page loading method includes:First page load step 100 and second page load step 200.
First page load step 100 includes:
Step 101, loading script file, the script file include the public script file of encapsulation;
Step 102, parse and perform the script file;
The correspondence of public script file after step 103, the forms object for determining second page and the parsing
Relation, wherein, the second page is nested in the first page, as shown in Figure 1;
Second page load step 200 includes:
Step 201, according to the corresponding relation, determine described corresponding to the forms object of the second page
Public script file;
Step 202, the content for performing the public script file.
Alternatively, common resource file can include jquery script files and/or prototype script files
Deng.
Alternatively, second page load step 200 can also include:Step 203, load, parse and hold
Other script files in the row second page in addition to common resource file.
In one embodiment, when writing web page code using iframe frameworks, first have to determine father
Which public script file the page and subpage frame include, and these public script files are packaged;
For example, if parent page includes a public script file a.js with some nested subpage frames, can use
Function (function) grammer in javascript is packaged to a.js, is packaged into script file wa.js.
Based on above-mentioned encapsulation, the public script file that the encapsulation is parsed in step 102 obtains including its envelope
The function reference of the content of the public script file of dress;And perform the public script file in the function
Content.
Here, well known to a person skilled in the art " function reference " refers to the pointer of function, i.e. function
A memory address;" forms object " is computerese, is a kind of encapsulation of document object, is led to
Often identified with window.
Then, determine that corresponding relation includes in step 104:First, first page find to perform it is public
One or more second pages of script file, determine the forms object of these second pages;Then, really
Determine the forms object of second page and the corresponding relation of function reference, the i.e. memory address of function.So as to,
When loading second page, the parameter using the forms object of the second page as function, you can perform letter
The content of public script file in number, reload, parse without second page, perform one time it is public
Script file.
The determination of above-mentioned corresponding relation can be determined by first page (parent page), can also be by the
Two pages (subpage frame) determine, or can be issued to this by network after server is decided
Ground terminal.
Using above-mentioned webpage loading method, repeat to load public script file when can avoid opening webpage,
So as to reduce page loading duration, user's waiting time is reduced, and greatly reduce local computer and calculate money
Source.
Application example one:
When S11, user open webpage, parent page is loaded, including:Script file wa.js after loading encapsulation;
S12, parsing obtain the WA function references for including the content in public script file a.js;
S13, loading subpage frame;
S14, parent page obtain the forms object (window) of subpage frame;
The parameter of S15, parent page using the forms object w1 of the subpage frame of acquisition as WA functions;
S16, WA functions are performed, i.e., what WA functions included is performed to the forms object w1 of subpage frame
Content in public script file a.js.
For other subpage frames in parent page, said process is similar.By above-mentioned loading flow,
Subpage frame parses public script file a.js without repeating loading.
Fig. 3 is the flow chart of the embodiment two of the webpage loading method of the application.As shown in figure 3, the net
Page loading method includes:First page load step 300 and second page load step 400.
First page load step 300 includes:
Step 301, loading script file, the script file include the public script file of encapsulation;
Step 302, parse and perform the script file;
Second page load step 400 includes:
The correspondence of public script file after step 401, the forms object for determining second page and the parsing
Relation, wherein, the second page is nested in the first page, as shown in Figure 1;
Step 402, according to the corresponding relation, determine described corresponding to the forms object of the second page
Public script file;
Step 403, the content for performing the public script file.
Alternatively, common resource file can include jquery script files and/or prototype script files
Deng.
Alternatively, second page load step 400 also includes:Step 404, load, parse and perform institute
State other script files in addition to common resource file in second page.
The present embodiment and above-described embodiment the difference is that only:Above-described embodiment one is in loading first
During the page, the forms object of second page is obtained by first page, the forms object of second page is conciliate
In the function reference association of the content including public script file obtained after analysis, so that second page can
Directly perform the content of the public script file after first page parsing;And the present embodiment two is second page
Itself determine if to need to perform public script file, when needed, obtain and parsed in first page
The function reference of the content including public script file arrived, by the forms object of second page itself and obtain
In the function reference association taken, so that second page can directly perform the public pin after first page parsing
The content of this document.
Application example two:
When S21, user open webpage, parent page is loaded, including:Script file wa.js after loading encapsulation;
S22, parsing obtain the WA function references for including the content in public script file a.js;
S23, loading subpage frame;
S24, when subpage frame needs to perform the content in public script file a.js, subpage frame obtain father's page
Obtained WA function references are parsed in face;
The parameter of S25, subpage frame using the forms object (window) of itself as WA functions;
S26, WA functions are performed, i.e., what WA functions included is performed to the forms object w1 of subpage frame
Content in public script file a.js.
For other subpage frames in parent page, said process is similar.By above-mentioned loading flow,
Subpage frame parses public script file a.js without repeating loading.
Fig. 4 is the structure chart of the embodiment of the webpage loading device of the application.As shown in figure 4, the webpage
Loading device includes:
Load-on module 41, for loading first page and second page, wherein, the second page is nested
In the first page;The script file in the first page is loaded, the script file includes envelope
The public script file of dress;
Execution module 42 is parsed, for the script file to be parsed and performed in the first page;
Determining module 43, for determine second page forms object and the parsing after public script text
The corresponding relation of part, and according to the corresponding relation, determine corresponding to the forms object of the second page
The public script file, wherein, the second page is nested in the first page;
The parsing execution module 42 is additionally operable to, and the public script file is performed in the second page
Content.
Wherein, the script file of the encapsulation is to use the function grammer in javascript to encapsulate.
Wherein, the parsing execution module 42 is additionally operable to, and the encapsulation is parsed in the first page
Public script file obtains the memory address for including the function of the content of the public script file, and holds
The content of public script file in the row function.
Wherein, the determining module 43 is additionally operable to:
In the first page, the forms object of second page is determined, and establishes the second page
The corresponding relation of the memory address of forms object and the function;Or
In the second page, with obtaining the internal memory of the function for the content for including the public script file
Location, and establish the corresponding relation of the forms object of the second page and the memory address of the function.
Wherein, the nested multiple second pages of the first page.
The above-mentioned webpage loading device of the application, loading public resource text is repeated when can avoid opening webpage
Part, so as to reduce page loading duration, user's waiting time is reduced, and greatly reduce local computer meter
Calculate resource;Internet resources can also be saved when sending web page files.
Certainly, any product for implementing the application it is not absolutely required to reach all the above excellent simultaneously
Point.
In a typical configuration, computing device includes one or more processors (CPU), input/defeated
Outgoing interface, network interface and internal memory.
Internal memory may include the volatile memory in computer-readable medium, random access memory
(RAM) and/or the form such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).
Internal memory is the example of computer-readable medium.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by
Any method or technique come realize information store.Information can be computer-readable instruction, data structure,
The module of program or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory
(PRAM), static RAM (SRAM), dynamic random access memory (DRAM), its
Random access memory (RAM), read-only storage (ROM), the electrically erasable of his type are read-only
Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage
(CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape magnetic
Disk storage or other magnetic storage apparatus or any other non-transmission medium, it can be counted available for storage
Calculate the information that equipment accesses.Defined according to herein, computer-readable medium does not include non-temporary computer
The data-signal and carrier wave of readable media (transitory media), such as modulation.
Although the embodiment disclosed by the application is as above, described content is only to readily appreciate the application
And the embodiment used, it is not limited to the application.Technology people in any the application art
Member, can be in the form of implementation and thin on the premise of the spirit and scope disclosed by the application are not departed from
Any modification and change, but the scope of patent protection of the application are carried out on section, still must be with appended right
The scope that claim is defined is defined.
Claims (17)
- A kind of 1. webpage loading method, it is characterised in that including:First page load step:Script file is loaded, the script file includes the public script file of encapsulation;Parse and perform the script file;Determine second page forms object and the parsing after public script file corresponding relation, its In, the second page is nested in the first page;Second page load step:According to the corresponding relation, the public script corresponding to the forms object of the second page is determined File;Perform the content of the public script file.
- 2. webpage loading method according to claim 1, it is characterised in that the second page adds The step of load, also includes:Load, parse and perform in the second page in addition to common resource file Other script files.
- 3. webpage loading method according to claim 1, it is characterised in that the encapsulation it is public Script file is to use the function grammer in javascript to encapsulate.
- 4. webpage loading method according to claim 3, it is characterised in that the parsing simultaneously performs The script file includes:The public script file for parsing the encapsulation obtains the function for including the content of the public script file Memory address;Perform the content of the public script file in the function.
- 5. webpage loading method according to claim 4, it is characterised in that the determination second page The corresponding relation of public script file after the forms object in face and the parsing includes:Determine the forms object of second page;Establish the corresponding relation of the forms object of the second page and the memory address of the function.
- 6. according to the webpage loading method described in claim any one of 1-5, it is characterised in that described The nested multiple second pages of one page.
- A kind of 7. webpage loading method, it is characterised in that including:First page load step:Script file is loaded, the script file includes the public script file of encapsulation;Parse and perform the script file;Second page load step:Determine second page forms object and the parsing after public script file corresponding relation, its In, the second page is nested in the first page;According to the corresponding relation, the public script corresponding to the forms object of the second page is determined File;Perform the content of the public script file.
- 8. webpage loading method according to claim 7, it is characterised in that the second page adds The step of load, also includes:Load, parse and perform in the second page in addition to common resource file Other script files.
- 9. webpage loading method according to claim 7, it is characterised in that the encapsulation it is public Script file is to use the function grammer in javascript to encapsulate.
- 10. webpage loading method according to claim 9, it is characterised in that described to parse and hold The row script file includes:The public script file for parsing the encapsulation obtains the function for including the content of the public script file Memory address;Perform the content of the public script file in the function.
- 11. webpage loading method according to claim 10, it is characterised in that described to determine second The corresponding relation of public script file after the forms object of the page and the parsing includes:Obtain the memory address of the function for the content for including the public script file;Establish the corresponding relation of the forms object of the second page and the memory address of the function.
- 12. according to the webpage loading method described in claim any one of 7-11, it is characterised in that described The nested multiple second pages of first page.
- A kind of 13. webpage loading device, it is characterised in that including:Load-on module, for loading first page and second page, wherein, the second page is nested in In the first page;The script file in the first page is loaded, the script file includes encapsulation Public script file;Execution module is parsed, for the script file to be parsed and performed in the first page;Determining module, for determine second page forms object and the parsing after public script file Corresponding relation, and according to the corresponding relation, determine institute corresponding to the forms object of the second page Public script file is stated, wherein, the second page is nested in the first page;The parsing execution module is additionally operable to, and the public script file is performed in the second page Content.
- 14. webpage loading device according to claim 13, it is characterised in that the public affairs of the encapsulation Script file is to use the function grammer in javascript to encapsulate altogether.
- 15. webpage loading device according to claim 14, it is characterised in thatThe parsing execution module is additionally operable to, and the public script of the encapsulation is parsed in the first page File obtains the memory address for including the function of the content of the public script file, and performs the letter The content of public script file in number.
- 16. webpage loading device according to claim 15, it is characterised in that the determining module It is additionally operable to:In the first page, the forms object of second page is determined, and establishes the second page The corresponding relation of the memory address of forms object and the function;OrIn the second page, with obtaining the internal memory of the function for the content for including the public script file Location, and establish the corresponding relation of the forms object of the second page and the memory address of the function.
- 17. according to the webpage loading device described in claim any one of 13-16, it is characterised in that described The nested multiple second pages of first page.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610509349.7A CN107562749A (en) | 2016-06-30 | 2016-06-30 | A kind of webpage loading method and webpage loading device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610509349.7A CN107562749A (en) | 2016-06-30 | 2016-06-30 | A kind of webpage loading method and webpage loading device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107562749A true CN107562749A (en) | 2018-01-09 |
Family
ID=60968565
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610509349.7A Pending CN107562749A (en) | 2016-06-30 | 2016-06-30 | A kind of webpage loading method and webpage loading device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107562749A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108427731A (en) * | 2018-02-26 | 2018-08-21 | 平安普惠企业管理有限公司 | Processing method, device, terminal device and the medium of page code |
CN111506354A (en) * | 2019-01-14 | 2020-08-07 | 福建天泉教育科技有限公司 | Method and terminal for improving script loading efficiency |
CN110321504B (en) * | 2019-06-18 | 2023-09-22 | 平安医疗健康管理股份有限公司 | Page processing method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102236665A (en) * | 2010-04-27 | 2011-11-09 | 华为技术有限公司 | Page loading method and page loading device |
CN104573066A (en) * | 2015-01-26 | 2015-04-29 | 中国工商银行股份有限公司 | Page reusing method and page reusing device |
-
2016
- 2016-06-30 CN CN201610509349.7A patent/CN107562749A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102236665A (en) * | 2010-04-27 | 2011-11-09 | 华为技术有限公司 | Page loading method and page loading device |
CN104573066A (en) * | 2015-01-26 | 2015-04-29 | 中国工商银行股份有限公司 | Page reusing method and page reusing device |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108427731A (en) * | 2018-02-26 | 2018-08-21 | 平安普惠企业管理有限公司 | Processing method, device, terminal device and the medium of page code |
CN111506354A (en) * | 2019-01-14 | 2020-08-07 | 福建天泉教育科技有限公司 | Method and terminal for improving script loading efficiency |
CN111506354B (en) * | 2019-01-14 | 2023-05-23 | 福建天泉教育科技有限公司 | Method and terminal for improving script loading efficiency |
CN110321504B (en) * | 2019-06-18 | 2023-09-22 | 平安医疗健康管理股份有限公司 | Page processing method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10699061B2 (en) | Application page quick access | |
CN106484383B (en) | Page rendering method, device and equipment | |
US11563674B2 (en) | Content based routing method and apparatus | |
US10013245B2 (en) | Systems and methods for converting typed code | |
CN106897251B (en) | Rich text display method and device | |
CN106909361B (en) | Web development method and device based on template engine | |
CN107133174A (en) | Test case code automatically generating device and method | |
US9979746B2 (en) | Method and apparatus for detecting hidden content of web page | |
CN103838558B (en) | Website build a station system and method, access website method and webpage adaptation system | |
CN107147645B (en) | Method and device for acquiring network security data | |
CN106886544A (en) | A kind of data processing method and device | |
CN107305528B (en) | Application testing method and device | |
CN105989126B (en) | A kind of Webpage display process and device | |
CN107562749A (en) | A kind of webpage loading method and webpage loading device | |
CN107635001A (en) | Web scripts abnormality eliminating method and device | |
CN111443909A (en) | Method and device for generating page | |
CN110069247A (en) | A kind of development approach and device, application method and device of application program | |
CN110213105A (en) | It is a kind of cross-platform micro- using creation method | |
CN107797837B (en) | Page display method, device, server and medium | |
CN108021564A (en) | A kind of method and apparatus of page reorientation | |
CN104156421B (en) | The page shows method, apparatus and system | |
CN110968314A (en) | Page generation method and device | |
CN110020242A (en) | A kind of document reading progress synchronous method and device based on Web | |
CN113094138A (en) | Interface display method and device, electronic equipment and storage medium | |
CN111767498B (en) | Method and device for realizing file information sharing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180109 |
|
RJ01 | Rejection of invention patent application after publication |