CN104965848A - Front-end resource loading method and apparatus - Google Patents
Front-end resource loading method and apparatus Download PDFInfo
- Publication number
- CN104965848A CN104965848A CN201510075489.3A CN201510075489A CN104965848A CN 104965848 A CN104965848 A CN 104965848A CN 201510075489 A CN201510075489 A CN 201510075489A CN 104965848 A CN104965848 A CN 104965848A
- Authority
- CN
- China
- Prior art keywords
- resource
- loaded
- loaded resource
- described front
- web document
- 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.)
- Granted
Links
- 238000011068 loading method Methods 0.000 title claims abstract description 53
- 238000000034 method Methods 0.000 claims abstract description 25
- 230000015654 memory Effects 0.000 claims description 15
- 230000004044 response Effects 0.000 claims description 14
- 238000012163 sequencing technique Methods 0.000 claims description 7
- 238000009877 rendering Methods 0.000 abstract 1
- 238000005516 engineering process Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 8
- 230000008569 process Effects 0.000 description 7
- 230000002093 peripheral effect Effects 0.000 description 5
- 230000003993 interaction Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 238000010295 mobile communication Methods 0.000 description 3
- 230000000712 assembly Effects 0.000 description 2
- 238000000429 assembly Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000013468 resource allocation Methods 0.000 description 2
- 230000008901 benefit Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 229920000642 polymer Polymers 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The invention relates to a front-end resource loading method and apparatus. The method comprises following steps: acquiring and analyzing a web document of a target site through a client, wherein the web document includes description information of a front-end resource to be loaded; determining whether the front-end resource to be loaded is locally stored according to the description information of the front-end resource to be loaded; reading the front-end resource to be loaded and adding the front-end resource to be loaded to the web document if the front-end resource to be loaded is locally stored; making a request to a sever to load the front-end resource to be loaded and adding the loaded front-end resource to be loaded to the web document if the front-end resource to be loaded is not locally stored; and displaying the web document to which the front-end resource to be loaded is added. By employing the method and the apparatus, the speed of loading the needed front-end resource when the client is not used for the first time can be improved, the flow occupied by loading can be reduced, and the interruption rate caused by a condition that the client loads the front-end resource when rendering web pages can be reduced.
Description
Technical field
The present invention relates to field of computer technology, particularly a kind of front end resource loading method and device.
Background technology
It is that a kind of special Web applies that single page Web applies (SPA, single-page application).All activities are confined in a Web page by it, only load corresponding HTML (Hypertext Markup Language) (HTML when this Web page initialization, HyperText Mark-up Language), JavaScript and CSS (cascading style sheet) (CSS, Cascading Style Sheets).Complete once the page loads, SPA can not carry out reloading or redirect of the page because of the operation of user.The substitute is the content utilizing JavaScript to convert HTML dynamically, thus realize the mutual of user interface (UI, UserInterface) and user.Owing to avoiding reloading of the page, SPA can provide comparatively smooth Consumer's Experience.
In prior art, usually html tag is utilized to carry out direct embedded resource content or outreach resource file, or, the application programming interface (API, ApplicationProgramming Interface) using some browsers to have generates the label of respective resources dynamically and is inserted in the middle of document with the download guiding browser to carry out resource.
In the above prior art, when downloaded resources file, playing up of full page will be blocked, and interrupt the response of user interactions until respective resources files loading be parsed and just can recover playing up of the page simultaneously, and, when the non-resource file of loading first, even if resource file does not upgrade, browser still needs to send abundant request with the content of Gains resources, requested many time take Internet resources, lower efficiency, and, load unsuccessfully if there is a certain resource, then may cause page layout's entanglement, lose efficacy alternately.
Summary of the invention
In view of this, the invention provides a kind of front end resource loading method and device, front end resource is pulled by client concurrent request, and utilize the local storage capacity of this client, improve the non-speed loading required front end resource when using this client first, reduce the flow shared by loading, and reduce when client plays up webpage owing to loading this front end resource and cause play up interruption rate.
The embodiment of the present invention provides a kind of front end resource loading method, comprising:
Client obtains and resolves the web document of targeted sites, comprises the descriptor of front end to be loaded resource in described web document;
According to the descriptor of described front end to be loaded resource, judge whether to store described front end to be loaded resource in this locality;
If so, then read described front end to be loaded resource and be added into described web document, if not, then downloading described front end to be loaded resource to server request, the front end described to be loaded resource downloaded is added into described web document;
Show the described web document being added into described front end to be loaded resource.
The embodiment of the present invention provides a kind of front end resource charger, comprising:
Acquisition module, for obtaining the web document of targeted sites, comprises the descriptor of front end to be loaded resource in described web document;
Parsing module, for resolving the web document of the described targeted sites that described acquisition module obtains;
Judge module, for the descriptor according to described front end to be loaded resource, judges whether to store described front end to be loaded resource in this locality;
Read module, if judge to store described front end to be loaded resource in this locality for described judge module, then reads described front end to be loaded resource;
Add module, the front end described to be loaded resource that this locality for being read by described read module stores is added into described web document;
Request module, if judge not store described front end to be loaded resource in this locality for described judge module, then downloads described front end to be loaded resource to server request;
Described interpolation module, also for the front end described to be loaded resource downloaded is added into described web document;
Display module, for showing the described web document being added into described front end to be loaded resource.
A kind of front end resource loading method provided according to above-described embodiment and device, by the descriptor of client according to the front end to be loaded resource comprised in web document, judge whether store this front end to be loaded resource in this locality, if, then directly read this front end to be loaded resource from this locality and be added into this web document, if not, then download this front end to be loaded resource to server request and add this web document, the non-speed loading required front end resource when using this client first can be improved, reduce flow and take.
For above and other object of the present invention, feature and advantage can be become apparent, preferred embodiment cited below particularly, and coordinate institute's accompanying drawings, be described in detail below.
Accompanying drawing explanation
The applied environment figure of the front end resource loading method that Fig. 1 provides for the embodiment of the present invention and device.
Fig. 2 is a kind of structural representation of mobile terminal;
The process flow diagram of the front end resource loading method that Fig. 3 provides for first embodiment of the invention;
The process flow diagram of the front end resource loading method that Fig. 4 provides for second embodiment of the invention;
The structural representation of the front end resource charger that Fig. 5 provides for third embodiment of the invention;
The structural representation of the front end resource charger that Fig. 6 provides for fourth embodiment of the invention.
Embodiment
For further setting forth the present invention for the technological means that realizes predetermined goal of the invention and take and effect, below in conjunction with accompanying drawing and preferred embodiment, to according to the specific embodiment of the present invention, structure, feature and effect thereof, be described in detail as follows.
The applied environment figure of the front end resource loading method that Fig. 1 provides for the embodiment of the present invention and device.As shown in Figure 1, mobile terminal 100 and server 200 are arranged in wired or wireless network, carry out data interaction, to realize the front end resource loading method that following embodiment provides by this wired or wireless network.
Front end resource loading method in the present invention can be applicable to single-page WEB (webpage) APP (Application based on HTML5, application program) in the middle of, this APP can be the client-side program be arranged in mobile terminal device, that is, user is used during this APP by the mobile terminal device comprising smart mobile phone, panel computer, notebook computer etc. and the front end resource loading method in the present invention can be utilized to load the front end resource in the web document of targeted sites.
Technical scheme of the present invention has following requirement for hardware and software environment:
Have the terminal device of network access capacity, and, the browser kernel of compatible HTML5javaScript API.
Front end resource in the embodiment of the present invention refers to and the minimal set that a single-page WEB APP is required when performing smoothly is generally javaScript source file, CSS source file.
Particularly, mobile terminal 100 is obtained by client and resolves the web document of targeted sites, the descriptor of front end to be loaded resource is comprised in this web document, then according to the descriptor of this front end to be loaded resource, judge whether to store this front end to be loaded resource in this locality, and when this locality stores this front end resource to be loaded, read this front end to be loaded resource and be added into this web document, this web document being added into this front end to be loaded resource is illustrated on the screen of mobile terminal 100, and when this locality does not store this front end resource to be loaded, ask to download this front end to be loaded resource to server 200, this front end to be loaded resource downloaded is added into this web document, this web document being added into this front end to be loaded resource is illustrated on the screen of mobile terminal 100.
Refer to Fig. 2, Fig. 2 is a kind of structural representation of mobile terminal.
Mobile terminal 100 comprises storer 102, memory controller 104, one or more (only illustrating one in figure) processor 106, Peripheral Interface 108, radio-frequency module 110, locating module 112, photographing module 114, audio-frequency module 116, Touch Screen 118 and key-press module 120.These assemblies are by one or more communication bus/signal wire 122 communication mutually.
Be appreciated that the structure shown in Fig. 2 is only signal, mobile terminal 100 also can comprise than assembly more or less shown in Fig. 2, or has the configuration different from shown in Fig. 2.Each assembly shown in Fig. 2 can adopt hardware, software or its combination to realize
Storer 102 can be used for storing software program and module, as the front end resource loading method in mobile terminal in the embodiment of the present invention and programmed instruction/module corresponding to device, processor 106 is by running the software program and module that are stored in storer 102, thus perform the application of various function and data processing, namely realize front end resource loading method by the client be arranged in above-mentioned mobile terminal.
Storer 102 can comprise high speed random access memory, also can comprise nonvolatile memory, as one or more magnetic storage device, flash memory or other non-volatile solid state memories.In some instances, storer 102 can comprise the storer relative to the long-range setting of processor 106 further, and these remote memories can be connected to terminal device 100 by network.The example of above-mentioned network includes but not limited to internet, intranet, LAN (Local Area Network), mobile radio communication and combination thereof.Processor 306 and other possible assemblies can carry out the access of storer 102 under the control of memory controller 304.
Various input/output device is coupled to CPU and storer 102 by Peripheral Interface 108.Various softwares in processor 106 run memory 102, instruction are to perform the various function of terminal device 100 and to carry out data processing.
In certain embodiments, Peripheral Interface 108, processor 106 and memory controller 104 can realize in one single chip.In some other example, they can respectively by independently chip realization.
Radio-frequency module 110, for receiving and sending electromagnetic wave, realizes the mutual conversion of electromagnetic wave and electric signal, thus carries out communication with communication network or other equipment.Radio-frequency module 110 can comprise the various existing circuit component for performing these functions, such as, and antenna, radio-frequency (RF) transceiver, digital signal processor, encrypt/decrypt chip, subscriber identity module (SIM) card, storer etc.Radio-frequency module 110 can with various network as internet, intranet, wireless network carry out communication or carry out communication by wireless network and other equipment.Above-mentioned wireless network can comprise cellular telephone networks, WLAN (wireless local area network) or Metropolitan Area Network (MAN).Above-mentioned wireless network can use various communication standard, agreement and technology, include, but are not limited to global system for mobile communications (Global System for MobileCommunication, GSM), enhancement mode mobile communication technology (Enhanced Data GSMEnvironment, EDGE), Wideband CDMA Technology (wideband code division multipleaccess, W-CDMA), CDMA (Code Division Multiple Access) (Code division access, CDMA), tdma (time division multiple access, TDMA), bluetooth, adopting wireless fidelity technology (Wireless, Fidelity, WiFi) (as IEEE-USA standard IEEE 802.11a, IEEE 802.11b, IEEE802.11g and/or IEEE 802.11n), the networking telephone (Voiceover internet protocal, VoIP), worldwide interoperability for microwave access (Worldwide Interoperabilityfor Microwave Access, Wi-Max), other are for mail, the agreement of instant messaging and short message, and any other suitable communications protocol, even can comprise those current agreements be developed not yet.
Locating module 112 is for obtaining the current location of terminal device 100.The example of locating module 112 includes but not limited to Global Positioning System (GPS) (GPS), location technology based on WLAN (wireless local area network) or mobile radio communication.
Photographing module 114 is for taking pictures or video.Photo or the video of shooting can be stored in storer 102, and send by radio-frequency module 110.
Audio-frequency module 116 provides audio interface to user, and it can comprise one or more microphone, one or more loudspeaker and voicefrequency circuit.Voicefrequency circuit receives voice data from Peripheral Interface 108, voice data is converted to telecommunications breath, and telecommunications breath is transferred to loudspeaker.Telecommunications breath is changed the sound wave can heard into people's ear by loudspeaker.Voicefrequency circuit also from microphone receive telecommunications breath, convert electrical signals to voice data, and by data transmission in network telephony to Peripheral Interface 108 to be further processed.Voice data can obtain from storer 102 or by radio-frequency module 110.In addition, voice data also can be stored in storer 102 or by radio-frequency module 110 and send.In some instances, audio-frequency module 116 also can comprise an earphone and broadcast hole, for providing audio interface to earphone or other equipment.
Touch Screen 118 provides one simultaneously and exports and inputting interface between mobile terminal device 100 and user.Particularly, Touch Screen 118 exports to user's display video, and the content of these video frequency output can comprise word, figure, video and combination in any thereof.Some Output rusults correspond to some user interface object.Touch Screen 118 also receives the input of user, and the gesture operation such as click, slip of such as user, so that response is made in the input of user interface object to these users.The technology detecting user's input can be based on resistance-type, condenser type or other touch control detection technology possible arbitrarily.The instantiation of Touch Screen 118 display unit includes, but are not limited to liquid crystal display or light emitting polymer displays.
Key-press module 120 provides user to carry out the interface inputted to mobile terminal device 100 equally, and user can move the different function of 100 execution by pressing different buttons to make terminal device.
First embodiment
Refer to Fig. 3, be a kind of front end resource loading method that first embodiment of the invention provides, can be applicable in the mobile terminal 100 shown in Fig. 1, realize client-based front end resource and load, the method comprises:
S101, client obtain and resolve the web document of targeted sites, comprise the descriptor of front end to be loaded resource in this web document;
User accesses installation WEB APP on the client, and for ease of describing, the embodiment of the present invention is to be arranged on the browser APP on smart mobile phone.
User access browser APP, browser APP obtain and resolve the web document of targeted sites, and wherein, targeted sites can be the website that the resource content in browser APP homepage is corresponding, and this web document can be html document.The descriptor of front end to be loaded resource is comprised in this web document.This front end to be loaded resource minimal set that to be a single-page WEB APP required when performing smoothly, is generally javaScript source file, CSS source file.This descriptor is for describing the mark of this front end to be loaded resource, character and feature.
S102, descriptor according to this front end to be loaded resource, judge whether to store this front end to be loaded resource in this locality;
According to this descriptor, judge whether store this front end to be loaded resource in this locality of client.
If so, then perform step S103, then perform step S105; If not, then perform step S104, then perform step S105.
S103, read this front end to be loaded resource and be added into this web document;
If this locality stores this front end to be loaded resource, then, after this front end to be loaded resource is read in this locality, be added in this web document.
S104, download this front end to be loaded resource to server request, this front end to be loaded resource downloaded is added into this web document;
If this locality does not store this front end to be loaded resource, the request of downloading this front end to be loaded resource is then sent to server 200, this front end to be loaded resource that reception server 200 returns in response to this request, and this front end to be loaded resource downloaded is added into this web document.
S105, show and be added into this web document of this front end to be loaded resource.
Browser APP is after being added into this web document by all front end to be loaded resources, by performing preset initiation of services code, perform corresponding business (e.g., webpage plays up business etc.), this web document to be illustrated on the screen of smart mobile phone.
The front end resource loading method that the present embodiment provides, by the descriptor of client according to the front end to be loaded resource comprised in web document, judge whether store this front end to be loaded resource in this locality, if, then directly read this front end to be loaded resource from this locality and be added into this web document, if not, then download this front end to be loaded resource to server request and add this web document, the non-speed loading required front end resource when using this client first can be improved, reduce flow and take.
Second embodiment
Refer to Fig. 4, for second embodiment of the invention provides a kind of front end resource loading method, can be applicable in the mobile terminal 100 shown in Fig. 1, realize client-based front end resource and load, the method comprises:
S201, client obtain and resolve the web document of targeted sites, comprise the descriptor of front end to be loaded resource in this web document;
User access browser APP, browser APP are obtained by http protocol and resolve the web document of targeted sites, and wherein, targeted sites is the website that the resource content in browser APP homepage is corresponding, and this web document can be html document.The descriptor of front end to be loaded resource is comprised in this web document.This front end to be loaded resource minimal set that to be a single-page WEB APP required when performing smoothly, is generally javaScript source file, CSS source file.This descriptor is for describing the mark of this front end to be loaded resource, character and feature.Particularly, this descriptor comprises: the title of this front end to be loaded resource, version number and memory address, and this version number is an issuing time stamp normally, and this memory address can be used for the front end to be loaded resource of asking to be stored in this memory address.
S202, check the local resource that the local title whether storing front end to be loaded with this resource is identical;
According to the title of the front end to be loaded of this in this descriptor resource, whether this locality (also namely mobile terminal 100 is local) of viewing client-side stores the identical local resource of the title of front end to be loaded with this resource.
It should be noted that, technical scheme in the present embodiment utilizes localStorage (local storage) as medium, most browser all supports that localStorage is as this technology of medium, so when user is accessed by browser APP without the need to worrying incompatible situation.When searching the resource of the local storage of coupling, first search in localStorage whether have corresponding resource by resource name.
If so, then perform step S203, check that whether the version number of this local resource is identical with the version number of this front end to be loaded resource; If not, then perform step S205, determine not store this front end to be loaded resource in this locality of this client.
S203, check that whether the version number of this local resource is identical with the version number of this front end to be loaded resource;
According to the version number of the front end to be loaded of this in this descriptor resource, check that this locality of this client stores whether with the version number of this to be loaded front end resource identical with this front end to be loaded resource if having the version number of this local resource of same names.
If so, then perform step S204, determine to store this front end to be loaded resource in this locality of this client, then perform step S206; If not, then perform step S205, determine not store this front end to be loaded resource in this locality of this client, then perform step S207.
S204, determine to store this front end to be loaded resource in this locality of this client;
When according to the title of the front end to be loaded of this in this descriptor resource and version number, view mobile terminal 100 this locality when storing the title of front end to be loaded with this resource and all identical local resource of version number, then determine to store this front end to be loaded resource in this locality of this client.
S205, determine not store this front end to be loaded resource in this locality of this client;
When according to the title of the front end to be loaded of this in this descriptor resource and version number, do not view mobile terminal 100 this locality when storing the title of front end to be loaded with this resource and all identical local resource of version number, also be, when the title of the local resource of mobile terminal 100 this locality storage is not identical with the title of this front end to be loaded resource, or although the title of the two is identical, but when the version number of the two is different, then determine not store this front end to be loaded resource in this locality of client.
If S206 determines to store this front end to be loaded resource in this locality of this client, then read this front end to be loaded resource and be added into this web document;
Store this front end to be loaded resource in this locality of this client if determine, then direct read this front end to be loaded resource from this locality and add (loading) enter this web document.
If S207 determines not store this front end to be loaded resource in this locality of this client, then download this front end to be loaded resource to server request, this front end to be loaded resource downloaded is added into this web document;
This front end to be loaded resource is not stored in this locality of this client if determine, then browser APP utilizes asynchronous JavaScript and XML (AJAX, Asynchronous Javascript And XML) send request to server 200, to pull this front end to be loaded resource from server 200.Understandably, server 200 can be individual server or server cluster, and also namely this front end to be loaded resource all can be stored in a server or disperse to be stored in different servers.
Further, due to network environment more complicated, when downloading this front end resource to be loaded to server request, can real-time listening server to request this front end to be loaded resource responsive state, when the response timeout of asking or failure, this front end to be loaded resource is downloaded in request again.Thus when resource loads unsuccessfully, automatic retry, reduces and loads mortality.In an example, the responsive state of this front end to be loaded resource of request can be obtained by utilization state word.
In the present embodiment, the afterbody of this web document comprises code corresponding to the mode that loads this front end to be loaded resource, also be, code corresponding for the mode loading this front end to be loaded resource is placed in the afterbody of this web document, browser APP can be allowed like this not to be interrupted as far as possible when resolving this web document, thus to accelerate page layout's response time.
Further, by performing the code being placed in the afterbody of this web document, if the quantity downloading this front end to be loaded resource is multiple, then according to the sequencing of request, these front end to be loaded resources multiple downloaded are added into this web document.Understandably, if the quantity of the front end to be loaded resource downloaded is multiple, the request of downloading this front end to be loaded resource can for multiple parallel, to improve speed of download, but after downloading to multiple front ends to be loaded resource, then according to the sequencing of request, the front end multiple to be loaded resource downloaded is added (loading) and enter this web document, with the dependence between the resource of the difference guaranteeing to have dependence front end to be loaded.Such as: suppose in this web document, to comprise 4 front end resource A to be loaded, B, C, D, wherein the correct loading of B depends on the correct loading of A, the correct loading of C depends on the correct loading of B, browser APP is according to A, B, C, the sequencing of D downloads above-mentioned 4 front end to be loaded resources to each server request simultaneously, although due to each front end to be loaded resource size of data and and each server between the difference of network transfer speeds, the order completing download is B, A, C, D, but browser APP still can according to A, B, C, above-mentioned 4 front end to be loaded resources are added into this web document by the sequencing of D, make B, C can not because being caused unnecessary loading failure by loading in advance, thus guarantee that all front ends to be loaded resource can be loaded smoothly, improve loading efficiency.
Further, after downloading this front end to be loaded resource, upgraded in this locality, comprise corresponding resource content and version number in the local storage of renewal and, in order to use during next loading, load the response time to reduce further.
S208, show and be added into this web document of this front end to be loaded resource.
Browser APP is after being added into this web document by all front end to be loaded resources, by performing preset initiation of services code, perform corresponding business (e.g., webpage plays up business etc.), this web document to be illustrated on the screen of smart mobile phone.
By the loading front end resource allocation method provided in above-described embodiment, load front end resource and there is higher stability, lower data traffic, and response speed faster.
The loading front end resource allocation method that the present embodiment provides, by the descriptor of client according to the front end to be loaded resource comprised in web document, judge whether store this front end to be loaded resource in this locality, if, then directly read this front end to be loaded resource from this locality and be added into this web document, if not, then download this front end to be loaded resource to server request and add this web document, the non-speed loading required front end resource when using this client first can be improved, reduce flow and take.Further, code corresponding for the mode loading this front end to be loaded resource is placed in the afterbody of this web document, the impact of playing up of resource file loading on the page can be reduced when loading resource file, reducing the interruption rate of webpage and user interactions.Further, when downloading front end resource to this server request, snoop responses state, when the response timeout of asking or failure, this front end to be loaded resource is downloaded in request again, and namely when resource loads unsuccessfully, automatic retry, can reduce loading mortality.
3rd embodiment
Refer to Fig. 5, for third embodiment of the invention provides a kind of front end resource charger.As shown in Figure 5, front end resource charger 40 comprises:
Acquisition module 401, for obtaining the web document of targeted sites, comprises the descriptor of front end to be loaded resource in this web document;
Parsing module 402, for resolving the web document of this targeted sites that acquisition module 401 obtains;
Judge module 403, for the descriptor according to this front end to be loaded resource, judges whether to store this front end to be loaded resource in this locality;
Read module 404, if judge to store this front end to be loaded resource in this locality for judge module 403, then reads this front end to be loaded resource;
Add module 405, this front end to be loaded resource that this locality for being read by read module 404 stores is added into this web document;
Request module 406, if judge not store this front end to be loaded resource in this locality for judge module 403, then downloads this front end to be loaded resource to server request;
Add module 405, also for this front end to be loaded resource downloaded is added into this web document;
Display module 407, for showing this web document being added into this front end to be loaded resource.
The present embodiment, to the detailed process of each Implement of Function Module of front end resource charger 40 function separately, refers to the particular content described in each embodiment shown in above-mentioned Fig. 1 to Fig. 4, repeats no more herein.
The front end resource charger that the present embodiment provides, by the descriptor according to the front end to be loaded resource comprised in web document, judge whether store this front end to be loaded resource in this locality, if, then directly read this front end to be loaded resource from this locality and be added into this web document, if not, then download this front end to be loaded resource to server request and add this web document, the non-speed loading required front end resource when using this client first can be improved, reduce flow and take.
4th embodiment
Referring to Fig. 6, is a kind of front end resource charger that fourth embodiment of the invention provides.As shown in Figure 6, front end resource charger 50 comprises:
Acquisition module 501, for obtaining the web document of targeted sites, comprises the descriptor of front end to be loaded resource in this web document;
Parsing module 502, for resolving the web document of this targeted sites that acquisition module 501 obtains;
Judge module 503, for the descriptor according to this front end to be loaded resource, judges whether to store this front end to be loaded resource in this locality;
Read module 504, if judge to store this front end to be loaded resource in this locality for judge module 503, then reads this front end to be loaded resource;
Add module 505, this front end to be loaded resource that this locality for being read by read module 504 stores is added into this web document;
Request module 506, if judge not store this front end to be loaded resource in this locality for judge module 503, then downloads this front end to be loaded resource to server request;
Add module 505, also for this front end to be loaded resource downloaded is added into this web document;
Display module 507, for showing this web document being added into this front end to be loaded resource.
Further, the descriptor of this front end to be loaded resource comprises the title of this front end to be loaded resource, version number and memory address.
Further, judge module 503 comprises:
Check module 5031, for checking the local resource that the local title whether storing front end to be loaded with this resource is identical;
Check module 5031, if also store the identical local resource of the title of front end to be loaded with this resource for this locality, then check that whether the version number of this local resource is identical with the version number of this front end to be loaded resource;
Determination module 5032, if do not store the identical local resource of the title of front end to be loaded with this resource for this locality, then determines not store this front end to be loaded resource in this locality of client;
Determination module 5032, if the version number also for this local resource is identical with the version number of this front end to be loaded resource, then determines to store this front end to be loaded resource in this locality of this client;
Determination module 5032, if the version number also for this local resource is not identical with the version number of this front end to be loaded resource, then determines not store this front end to be loaded resource in this locality of this client.
Further, the afterbody of this web document comprises and loads code corresponding to the mode of this front end to be loaded resource.
Further, adding module 505, also for by performing described code, if the quantity downloading described front end to be loaded resource is multiple, then according to the sequencing of request, the multiple described front end to be loaded resource downloaded being added into described web document.
Further, front end resource charger 50 also comprises:
Monitor module 508, during for downloading this front end resource to be loaded to server request, the responsive state of interception request, when the response timeout of asking or failure, described front end to be loaded resource is downloaded in request again.
Further, front end resource charger 50 also comprises:
Update module 509, for by this front end to be loaded resource updates in this locality.
The present embodiment, to the detailed process of each Implement of Function Module of front end resource charger 40 function separately, refers to the particular content described in each embodiment shown in above-mentioned Fig. 1 to Fig. 4, repeats no more herein.
The front end resource charger that the present embodiment provides, by the descriptor according to the front end to be loaded resource comprised in web document, judge whether store this front end to be loaded resource in this locality, if, then directly read this front end to be loaded resource from this locality and be added into this web document, if not, then download this front end to be loaded resource to server request and add this web document, the non-speed loading required front end resource when using this client first can be improved, reduce flow and take.Further, code corresponding for the mode loading this front end to be loaded resource is placed in the afterbody of this web document, the impact of playing up of resource file loading on the page can be reduced when loading resource file, reducing the interruption rate of webpage and user interactions.Further, when downloading front end resource to this server request, snoop responses state, when the response timeout of asking or failure, this front end to be loaded resource is downloaded in request again, and namely when resource loads unsuccessfully, automatic retry, can reduce loading mortality.
It should be noted that, each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For device class embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
It should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or device and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or device.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the device comprising key element and also there is other identical element.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.
Above, it is only preferred embodiment of the present invention, not any pro forma restriction is done to the present invention, although the present invention discloses as above with preferred embodiment, but and be not used to limit the present invention, any those skilled in the art, do not departing within the scope of technical solution of the present invention, make a little change when the technology contents of above-mentioned announcement can be utilized or be modified to the Equivalent embodiments of equivalent variations, in every case be do not depart from technical solution of the present invention content, according to any simple modification that technical spirit of the present invention is done above embodiment, equivalent variations and modification, all still belong in the scope of technical solution of the present invention.
Claims (14)
1. a front end resource loading method, is characterized in that, comprising:
Client obtains and resolves the web document of targeted sites, comprises the descriptor of front end to be loaded resource in described web document;
According to the descriptor of described front end to be loaded resource, judge whether to store described front end to be loaded resource in this locality;
If so, then read described front end to be loaded resource and be added into described web document, if not, then downloading described front end to be loaded resource to server request, the front end described to be loaded resource downloaded is added into described web document;
Show the described web document being added into described front end to be loaded resource.
2. method according to claim 1, is characterized in that, the descriptor of described front end to be loaded resource comprises the title of described front end to be loaded resource, version number and memory address.
3. method according to claim 2, is characterized in that, the described descriptor according to described front end to be loaded resource, judges whether described client stores described front end to be loaded resource in this locality and comprise:
Check whether this locality stores the local resource identical with the title of described front end to be loaded resource;
If so, then check that whether the version number of described local resource is identical with the version number of described front end to be loaded resource, if not, then determine not store described front end to be loaded resource in this locality of described client;
If the version number of described local resource is identical with the version number of described front end to be loaded resource, then determine to store described front end to be loaded resource in this locality of described client, if the version number of described local resource is not identical with the version number of described front end to be loaded resource, then determine not store described front end to be loaded resource in this locality of described client.
4. the method according to any one of claims 1 to 3, is characterized in that, the afterbody of described web document comprises code corresponding to the mode that loads described front end to be loaded resource.
5. method according to claim 4, is characterized in that, the described front end described to be loaded resource by download is added into described web document and comprises:
By performing described code, if the quantity downloading described front end to be loaded resource is multiple, then according to the sequencing of request, the multiple described front end to be loaded resource downloaded is added into described web document.
6. method according to claim 5, is characterized in that, described method also comprises:
When downloading described front end resource to be loaded to server request, the responsive state of interception request;
When the response timeout of asking or failure, described front end to be loaded resource is downloaded in request again.
7. method according to claim 6, is characterized in that, describedly also comprises after server request downloads described front end to be loaded resource:
By described front end to be loaded resource updates in this locality.
8. a front end resource charger, is characterized in that, comprising:
Acquisition module, for obtaining the web document of targeted sites, comprises the descriptor of front end to be loaded resource in described web document;
Parsing module, for resolving the web document of the described targeted sites that described acquisition module obtains;
Judge module, for the descriptor according to described front end to be loaded resource, judges whether to store described front end to be loaded resource in this locality;
Read module, if judge to store described front end to be loaded resource in this locality for described judge module, then reads described front end to be loaded resource;
Add module, the front end described to be loaded resource that this locality for being read by described read module stores is added into described web document;
Request module, if judge not store described front end to be loaded resource in this locality for described judge module, then downloads described front end to be loaded resource to server request;
Described interpolation module, also for the front end described to be loaded resource downloaded is added into described web document;
Display module, for showing the described web document being added into described front end to be loaded resource.
9. device according to claim 8, is characterized in that, the descriptor of described front end to be loaded resource comprises the title of described front end to be loaded resource, version number and memory address.
10. device according to claim 9, is characterized in that, described judge module comprises:
Check module, for checking whether this locality stores the local resource identical with the title of described front end to be loaded resource;
Describedly check module, if also store the local resource identical with the title of described front end to be loaded resource for this locality, then check that whether the version number of described local resource is identical with the version number of described front end to be loaded resource;
Determination module, if do not store the local resource identical with the title of described front end to be loaded resource for this locality, then determines not store described front end to be loaded resource in this locality of client;
Described determination module, if the version number also for described local resource is identical with the version number of described front end to be loaded resource, then determines to store described front end to be loaded resource in this locality of described client;
Described determination module, if the version number also for described local resource is not identical with the version number of described front end to be loaded resource, then determines not store described front end to be loaded resource in this locality of described client.
Device described in 11. any one of according to Claim 8 to 10, is characterized in that, the afterbody of described web document comprises code corresponding to the mode that loads described front end to be loaded resource.
12. devices according to claim 11, is characterized in that,
Described interpolation module, also for by performing described code, if the quantity downloading described front end to be loaded resource is multiple, is then added into described web document according to the sequencing of request by the multiple described front end to be loaded resource downloaded.
13. devices according to claim 12, is characterized in that, described device also comprises:
Monitor module, during for downloading described front end resource to be loaded to server request, the responsive state of interception request, when the response timeout of asking or failure, described front end to be loaded resource is downloaded in request again.
14. devices according to claim 13, is characterized in that, described device also comprises:
Update module, for by described front end to be loaded resource updates in this locality.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510075489.3A CN104965848B (en) | 2015-02-12 | 2015-02-12 | A kind of front end resource loading method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510075489.3A CN104965848B (en) | 2015-02-12 | 2015-02-12 | A kind of front end resource loading method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104965848A true CN104965848A (en) | 2015-10-07 |
CN104965848B CN104965848B (en) | 2018-01-23 |
Family
ID=54219884
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510075489.3A Active CN104965848B (en) | 2015-02-12 | 2015-02-12 | A kind of front end resource loading method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104965848B (en) |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105447198A (en) * | 2015-12-30 | 2016-03-30 | 深圳市瑞铭无限科技有限公司 | Convenient page script importing method and device |
CN107256151A (en) * | 2017-05-27 | 2017-10-17 | 北京小米移动软件有限公司 | Processing method, device and the terminal of page rendering |
CN107273528A (en) * | 2017-06-28 | 2017-10-20 | 努比亚技术有限公司 | A kind of front and back end separation method, mobile terminal and computer-readable recording medium |
CN107357876A (en) * | 2017-07-06 | 2017-11-17 | 校脸科技(北京)有限公司 | A kind of web access methods and device |
CN107436899A (en) * | 2016-05-26 | 2017-12-05 | 阿里巴巴集团控股有限公司 | The implementation method and device of the vivo identification page |
CN107678820A (en) * | 2017-09-29 | 2018-02-09 | 北京金山安全软件有限公司 | Webpage processing method, device, server, terminal equipment and medium |
CN107844332A (en) * | 2016-09-20 | 2018-03-27 | 天脉聚源(北京)科技有限公司 | A kind of method and system of mobile webpage loading external resource |
CN108460053A (en) * | 2017-02-20 | 2018-08-28 | 平安科技(深圳)有限公司 | File memory method and device |
CN110096663A (en) * | 2019-03-18 | 2019-08-06 | 中国平安人寿保险股份有限公司 | Page loading method, device, electronic equipment and computer readable storage medium |
CN110858240A (en) * | 2018-08-14 | 2020-03-03 | 北京京东尚科信息技术有限公司 | Front-end module loading method and device |
CN111581555A (en) * | 2020-04-27 | 2020-08-25 | 北京字节跳动网络技术有限公司 | Document loading method, device, equipment and storage medium |
CN112559927A (en) * | 2020-12-23 | 2021-03-26 | 上海哔哩哔哩科技有限公司 | Webpage loading method and device |
CN112965756A (en) * | 2021-01-21 | 2021-06-15 | 北京达佳互联信息技术有限公司 | Page resource loading amount monitoring method and device, electronic equipment and storage medium |
CN113536174A (en) * | 2017-06-23 | 2021-10-22 | 创新先进技术有限公司 | Interface loading method, device and equipment |
CN115988052A (en) * | 2022-12-06 | 2023-04-18 | 深圳前海微众银行股份有限公司 | Resource request processing method and device |
CN117574015A (en) * | 2023-12-05 | 2024-02-20 | 北京中宏立达科技发展有限公司 | Webpage updating method and device, electronic equipment and storage medium |
CN117880537A (en) * | 2023-12-06 | 2024-04-12 | 上海百秋新网商数字科技有限公司 | Interface-free omni-channel e-commerce content management system and data reading method thereof |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102323890A (en) * | 2011-08-23 | 2012-01-18 | 百度在线网络技术(北京)有限公司 | The web page processing method, the Apparatus and system that are used for wireless terminal |
CN103218434A (en) * | 2013-04-15 | 2013-07-24 | 北京小米科技有限责任公司 | Method and device for loading static resource |
CN103699674A (en) * | 2013-12-31 | 2014-04-02 | 优视科技有限公司 | Webpage storing method, webpage opening method, webpage storing device, webpage opening device and webpage browsing system |
CN103873502A (en) * | 2012-12-11 | 2014-06-18 | 阿里巴巴集团控股有限公司 | Cache updating method and system, and update resource providing method and system |
-
2015
- 2015-02-12 CN CN201510075489.3A patent/CN104965848B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102323890A (en) * | 2011-08-23 | 2012-01-18 | 百度在线网络技术(北京)有限公司 | The web page processing method, the Apparatus and system that are used for wireless terminal |
CN103873502A (en) * | 2012-12-11 | 2014-06-18 | 阿里巴巴集团控股有限公司 | Cache updating method and system, and update resource providing method and system |
CN103218434A (en) * | 2013-04-15 | 2013-07-24 | 北京小米科技有限责任公司 | Method and device for loading static resource |
CN103699674A (en) * | 2013-12-31 | 2014-04-02 | 优视科技有限公司 | Webpage storing method, webpage opening method, webpage storing device, webpage opening device and webpage browsing system |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105447198A (en) * | 2015-12-30 | 2016-03-30 | 深圳市瑞铭无限科技有限公司 | Convenient page script importing method and device |
CN107436899A (en) * | 2016-05-26 | 2017-12-05 | 阿里巴巴集团控股有限公司 | The implementation method and device of the vivo identification page |
CN107844332A (en) * | 2016-09-20 | 2018-03-27 | 天脉聚源(北京)科技有限公司 | A kind of method and system of mobile webpage loading external resource |
CN108460053A (en) * | 2017-02-20 | 2018-08-28 | 平安科技(深圳)有限公司 | File memory method and device |
CN107256151B (en) * | 2017-05-27 | 2020-09-11 | 北京小米移动软件有限公司 | Processing method, device and terminal for page rendering |
CN107256151A (en) * | 2017-05-27 | 2017-10-17 | 北京小米移动软件有限公司 | Processing method, device and the terminal of page rendering |
CN113536174A (en) * | 2017-06-23 | 2021-10-22 | 创新先进技术有限公司 | Interface loading method, device and equipment |
CN107273528A (en) * | 2017-06-28 | 2017-10-20 | 努比亚技术有限公司 | A kind of front and back end separation method, mobile terminal and computer-readable recording medium |
CN107357876A (en) * | 2017-07-06 | 2017-11-17 | 校脸科技(北京)有限公司 | A kind of web access methods and device |
CN107678820A (en) * | 2017-09-29 | 2018-02-09 | 北京金山安全软件有限公司 | Webpage processing method, device, server, terminal equipment and medium |
CN107678820B (en) * | 2017-09-29 | 2021-08-24 | 北京金山安全软件有限公司 | Webpage processing method, device, server, terminal equipment and medium |
CN110858240A (en) * | 2018-08-14 | 2020-03-03 | 北京京东尚科信息技术有限公司 | Front-end module loading method and device |
CN110096663A (en) * | 2019-03-18 | 2019-08-06 | 中国平安人寿保险股份有限公司 | Page loading method, device, electronic equipment and computer readable storage medium |
CN111581555A (en) * | 2020-04-27 | 2020-08-25 | 北京字节跳动网络技术有限公司 | Document loading method, device, equipment and storage medium |
CN111581555B (en) * | 2020-04-27 | 2023-09-15 | 北京字节跳动网络技术有限公司 | Document loading method, device, equipment and storage medium |
CN112559927A (en) * | 2020-12-23 | 2021-03-26 | 上海哔哩哔哩科技有限公司 | Webpage loading method and device |
CN112965756A (en) * | 2021-01-21 | 2021-06-15 | 北京达佳互联信息技术有限公司 | Page resource loading amount monitoring method and device, electronic equipment and storage medium |
CN112965756B (en) * | 2021-01-21 | 2023-09-26 | 北京达佳互联信息技术有限公司 | Page resource loading amount monitoring method and device, electronic equipment and storage medium |
CN115988052A (en) * | 2022-12-06 | 2023-04-18 | 深圳前海微众银行股份有限公司 | Resource request processing method and device |
CN117574015A (en) * | 2023-12-05 | 2024-02-20 | 北京中宏立达科技发展有限公司 | Webpage updating method and device, electronic equipment and storage medium |
CN117880537A (en) * | 2023-12-06 | 2024-04-12 | 上海百秋新网商数字科技有限公司 | Interface-free omni-channel e-commerce content management system and data reading method thereof |
Also Published As
Publication number | Publication date |
---|---|
CN104965848B (en) | 2018-01-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104965848A (en) | Front-end resource loading method and apparatus | |
CN108121568B (en) | APP calling method and device, electronic equipment and readable storage medium | |
US7840631B2 (en) | Multimedia control with one-click device selection | |
CN107741844B (en) | Method and device for generating application installation package | |
JP6181214B2 (en) | Mobile device | |
TWI528282B (en) | Method for customizing launching of applications | |
CN104092723B (en) | Document down loading method, Apparatus and system | |
CN104935744A (en) | Verification code display method, verification code display device and mobile terminal | |
CN106331135B (en) | A partial interface updating method, system, client and server | |
CN108319662A (en) | Page processing method, device, electronic equipment and readable storage medium storing program for executing | |
CN104243517A (en) | Content sharing method and device used between different terminals | |
CN104424241B (en) | Web site url processing method based on two dimensional code, apparatus and system | |
CN102770850B (en) | Token for communicating with master device, corresponding communication system and method | |
CN104657201A (en) | Application push method, device, equipment and system | |
CN112312222A (en) | Video sending method and device and electronic equipment | |
JP5004857B2 (en) | Application update information providing system and application update information providing method | |
CN106201610A (en) | Web application accesses the method and device of the primary function of terminal | |
CN105611422A (en) | Online live broadcast method based on multi-media list and apparatus thereof | |
CN105095253A (en) | Webpage display method and webpage display device | |
CN104811485A (en) | Resource sharing method | |
US9521504B1 (en) | Channel selection in a mobile communication device application framework | |
US10977425B1 (en) | Dynamic resource refresh | |
CN110442416B (en) | Method, electronic device and computer-readable medium for presenting information | |
CN102469109A (en) | Display method of browser homepage in mobile terminal and apparatus thereof | |
CN104182331A (en) | Browser performance test method, browser performance test system and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |