CN104426925B - Web page resources acquisition methods and device - Google Patents

Web page resources acquisition methods and device Download PDF

Info

Publication number
CN104426925B
CN104426925B CN201310367699.0A CN201310367699A CN104426925B CN 104426925 B CN104426925 B CN 104426925B CN 201310367699 A CN201310367699 A CN 201310367699A CN 104426925 B CN104426925 B CN 104426925B
Authority
CN
China
Prior art keywords
web page
page resources
successfully
cdn
target webpage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310367699.0A
Other languages
Chinese (zh)
Other versions
CN104426925A (en
Inventor
郭力恒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201310367699.0A priority Critical patent/CN104426925B/en
Publication of CN104426925A publication Critical patent/CN104426925A/en
Application granted granted Critical
Publication of CN104426925B publication Critical patent/CN104426925B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources

Abstract

The present invention provides a kind of web page resources acquisition methods and devices.Wherein, which includes: and is accessed according to web access requests to target webpage, and needs the first web page resources loaded in target webpage to content distributing network CDN request;Judge whether successfully to obtain the first web page resources;If obtaining the first web page resources not successfully, consistent second web page resources of content with the first web page resources are obtained from the backup network other than CDN.The present invention solve in the prior art client can not from CDN obtain web page resources and caused by target webpage can not normally access the technical issues of, the technical effect normally accessed target webpage is realized, and has reached the technical effect for improving the reliability of web page access.

Description

Web page resources acquisition methods and device
Technical field
The present invention relates to the communications fields, in particular to a kind of web page resources acquisition methods and device.
Background technique
In existing Internet communication technology, network Web page (also referred to as webpage) usually will to promote access speed The web page resources of reference are stored in content distributing network CDN(Content Delivery Network) in.To such as Fig. 1 institute Show, when client accesses to webpage, the principle accessed nearby can be taken, by domain name system DNS (Domain Name System) server is that client distributes the node in CDN nearby, is carried out from the CDN node to web page resources needed for webpage It pulls, so as to shorten the load time of web page resources, and amount of access biggish webpage can be dispersed, web page resources are carried out The pressure of acquisition.The use of CDN greatly improves the page loading velocity of client, improves the accessibility of website.
However, the domain for being stored in independent CDN as usually requiring web page resources needed for by webpage in the application of CDN Under one's name, usually not identical so as to cause the domain name of the page and the domain name of web page resources.In the above scenario, if locating for client Network CDN can not normally be accessed, such as the network where some clients, such as company or school web, it is contemplated that The safety factor of domain name access is limited access of the client to CDN by way of the white list of website, then will lead to web page resources It can not normally obtain, so that the problem of causing webpage not access normally, affects the reliability of web page access.
In view of the above-mentioned problems, currently no effective solution has been proposed.
Summary of the invention
The main purpose of the present invention is to provide a kind of web page resources acquisition methods and devices, objective in the prior art to solve Family end can not from CDN obtain web page resources and caused by target webpage can not normally access the problem of.
To achieve the goals above, according to an aspect of the invention, there is provided a kind of web page resources acquisition methods.The party Method includes: to be accessed according to web access requests to target webpage, and need to load to content distributing network CDN request The first web page resources in above-mentioned target webpage;Judge whether successfully to obtain above-mentioned first web page resources;If failed obtain Above-mentioned first web page resources are then obtained from the backup network other than above-mentioned CDN consistent with the content of above-mentioned first web page resources Second web page resources.
To achieve the goals above, according to another aspect of the present invention, a kind of web page resources acquisition device is additionally provided.It should Device includes: access unit, is needed for being accessed according to web access requests to target webpage, and to CDN request Load the first web page resources in above-mentioned target webpage;Judging unit successfully obtains above-mentioned first webpage for judging whether Resource;First acquisition unit, for the backup network when obtaining above-mentioned first web page resources not successfully, other than above-mentioned CDN Obtain consistent second web page resources of content with above-mentioned first web page resources.
In embodiments of the present invention, to after the first web page resources of CDN request, according to first web page resources whether The judging result that success obtains, in failed obtain, by obtaining the content one with the first web page resources from backup network The second web page resources caused, meet the condition that corresponding web page element is normally loaded in target webpage, to solve existing Have in technology client that can not obtain web page resources from CDN and caused by target webpage the technical issues of can not normally accessing, it is real Show the technical effect normally accessed target webpage, and reaches the technical effect for improving the reliability of web page access.
Detailed description of the invention
The attached drawing constituted part of this application is used to provide further understanding of the present invention, schematic reality of the invention It applies example and its explanation is used to explain the present invention, do not constitute improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is a kind of schematic diagram of the implementation environment of web page resources acquisition methods according to prior art;
Fig. 2 is a kind of schematic diagram of optional web page resources acquisition methods according to an embodiment of the present invention;
Fig. 3 is the schematic diagram of another optional web page resources acquisition methods according to an embodiment of the present invention;
Fig. 4 is the schematic diagram of another optional web page resources acquisition methods according to an embodiment of the present invention;
Fig. 5 is the schematic diagram of another optional web page resources acquisition methods according to an embodiment of the present invention;
Fig. 6 is a kind of schematic diagram of the implementation environment of optional web page resources acquisition methods according to an embodiment of the present invention;
Fig. 7 is the schematic diagram of another optional web page resources acquisition methods according to an embodiment of the present invention;
Fig. 8 is the schematic diagram of another optional web page resources acquisition methods according to an embodiment of the present invention;
Fig. 9 is the schematic diagram of another optional web page resources acquisition methods according to an embodiment of the present invention;
Figure 10 is the schematic diagram of another optional web page resources acquisition methods according to an embodiment of the present invention;
Figure 11 is a kind of schematic diagram of optional web page resources acquisition device according to an embodiment of the present invention;
Figure 12 is the schematic diagram of another optional web page resources acquisition device according to an embodiment of the present invention;
Figure 13 is the schematic diagram of another optional web page resources acquisition device according to an embodiment of the present invention;
Figure 14 is the schematic diagram of another optional web page resources acquisition device according to an embodiment of the present invention;
Figure 15 is the schematic diagram of another optional web page resources acquisition device according to an embodiment of the present invention;
Figure 16 is the schematic diagram of another optional web page resources acquisition device according to an embodiment of the present invention;
Figure 17 is the schematic diagram of another optional web page resources acquisition device according to an embodiment of the present invention;
Figure 18 is the schematic diagram of another optional web page resources acquisition device according to an embodiment of the present invention.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, " Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product Or other step or units that equipment is intrinsic.
Embodiment 1
According to embodiments of the present invention, a kind of web page resources acquisition methods are provided.As shown in Fig. 2, this method may include:
S202: accessing to target webpage according to web access requests, and to content distributing network CDN(Content Delivery Network) first web page resources of the request needs load in target webpage;
S204: judge whether successfully to obtain the first web page resources, wherein
If it is not, executing step S206;
S206: consistent second web page resources of content with the first web page resources are obtained from the backup network other than CDN.
The web page resources acquisition methods provided according to embodiments of the present invention in step s 102 can be according to web page access Request accesses to target webpage, and needs the first web page resources loaded in the target webpage to CDN request.
In general, in embodiments of the present invention, the above-mentioned web access requests to target webpage usually may come from The identification clicked to the link of the direction target webpage in browser or user interface, also, one kind as Internet resources, The web page files of above-mentioned target webpage can usually pass through uniform resource position mark URL (Uniform Resource Locator) It is positioned, for example, in some embodiments of the invention, to there are URL hyperlink in above-mentioned browser or user interface The capture and identification of mouse click action on passage can form web access requests.Certainly, above-mentioned direction target The link of webpage can also be not present on text, but in other browsers such as icon, picture, video pictures or user interface In element on, this is not limited by the present invention.
It is worth noting that, being a kind of relatively conventional performance shape of web access requests described in above-described embodiment Formula, rather than necessary embodiment, for example, in some embodiments of the invention, the generations of web access requests can also be with The input signal for reading from computer input device is unrelated, for example, the web access requests can be by being currently running in client Application automatically generate, with formed to the pop-up page on browser or user interface, such as the access of navigation page, the present invention couple This is not limited in any way.
Based on the above-mentioned access request to target webpage, the access to target webpage may be implemented, however, since format limits System, web document itself corresponding with target webpage are typically not enough to cover all information content of presentation needed for it.
In general, target webpage can usually show as hypertext markup language html(Hypertext Markup Language) the web document of format, and can by the different elements edited in the web document, such as text, Image, audio, video, interactive form etc. define the specific presentation mode of target webpage, so as to show not in webpage The information of same type, and realize the interaction with external information.
Wherein, a part of inside that can be directly recorded in above-mentioned web document in above-mentioned web page element, by loader, Browser or user interface etc. are loaded directly into, and another part can utilize web document in such a way that external resource links The calling to these web page resources is realized in the chained address of the web page resources of the outside for being present in the web document of middle record, And be further advanced by loader, browser or user interface etc. and be loaded into target webpage, to constitute above-mentioned web page element.Its In, the chained address of above-mentioned web page resources can generally also show as URL, however this is not limited by the present invention.
As previously mentioned, in the prior art, the web page resources of the above-mentioned outside for being present in web document can be stored in Data link is shorter between web page access terminal, on node of the faster CDN of data transmission bauds, wherein the node can be used In indicating a domain in computer network, it can also indicate that a computer or server therein etc. have basic data The storaging medium of processing function.Wherein, above-mentioned be stored in CDN node can be used for mesh convenient for following description The web page resources of mark webpage load are denoted as the first web page resources.
Specifically, corresponding with above-mentioned web page element, the first web page resources can also there are many type, such as text, picture, Video file etc., and its file format can also there are many, for example, relatively conventional, may include Javascript script or Cascading style sheets CSS(Cascading Style Sheet) type file etc., the present invention do not do any restriction to this, answers It is interpreted as feasible any form of web page resources.
It is worth noting that, in embodiments of the present invention, target webpage can be remembered according in corresponding web document The URL of first web page resources of record calls first web page resources, however the first web page resources corresponding with the URL might not Necessarily be stored in scheduled position in CDN, for example, by the data dump of CDN server or update operation, can by this first Web page resources are deleted from CDN, or are updated and arrived other addresses or path, that is, in some embodiments of the invention, client Can be to the first web page resources of CDN request, however first web page resources can also be not present in above-mentioned CDN.It needs Illustrate, above-mentioned scene has no effect on the implementation of technical solution of the present invention, also should not be construed as constituting the present invention any It limits.
The web page resources acquisition methods provided according to embodiments of the present invention, as shown in Fig. 2, in step S204, Ke Yi After above-mentioned the first web page resources to CDN request, judge whether successfully to obtain first web page resources.
In general, the acquisition request of above-mentioned first web page resources can be shown as through corresponding URL to first The access of web page resources is called in other words, wherein for ease of description, by the above-mentioned chained address for being used to position the first web page resources It is defined as the first URL.
Specifically, in the above scenario, CDN for the response of above-mentioned web page resources acquisition request generally may include with Lower four kinds of situations:
1) CDN responds web page resources acquisition request, and sends client for the first web page resources;
2) CDN responds web page resources acquisition request, and there are the first web page resources corresponding with the first URL, but Client is sent by the first web page resources not successfully;
3) CDN responds web page resources acquisition request, but the first web page resources corresponding with the first URL are not present;
4) CDN does not respond web page resources acquisition request.
Wherein, for the first situation, it can be determined that going out successfully to obtain first web page resources namely client can be with Web page resources normally are obtained from CDN and realize the access to complete target webpage, obtain webpage money from CDN in view of client The scheme in source belongs to technical solution mature in the prior art, and the present invention does not make tired state herein.
For second case, specifically, in some embodiments of the invention, can pacify from the network of client Full setting, such as firewall, downloading shielding, the limitation of resource access being arranged in client or the domain locating for it etc., to lead Cause CDN after the acquisition request for receiving the first web page resources, the browsing that the first web page resources can not be sent in client Device or user interface etc., so as to judge to obtain first web page resources not successfully.
For the third situation, as previously mentioned, in some embodiments of the invention, the first web page resources can be stored in Position other than first URL, for example, the access path of the first URL is changed in the update operation of CDN server, Deng the first web page resources can not be sent to client so as to cause CDN, also may determine that obtain first net not successfully Page resource.
It, specifically, in some embodiments of the invention, can be from storage the first webpage money for the 4th kind of situation The access of node in the CDN in source is arranged, for example, visit of the user other than the white list for forbidding the node to be arranged to the node It asks, fails to make a response the acquisition request of the first web page resources so as to cause CDN, should also be judged as and obtain described not successfully One web page resources.
For above situation, it can be judged respectively to obtain whether successfully obtain first web page resources Judging result, however, on the other hand, the above-mentioned judgement operation for whether successfully obtaining first web page resources can also with Family setting is unrelated with network environment, for example can be monitored in the port that client is specified, and is sending web page resources with detection After acquisition request, if success receives the first web page resources from CDN.
Certainly, above embodiments are a kind of example, in embodiments of the present invention, can also by other means to whether Success obtains the first web page resources and is judged, optionally, as shown in figure 3, step S204 may include:
S302: judge whether that successfully the first web page resources are loaded into target webpage, wherein
If so, S304 is thened follow the steps,
If it is not, thening follow the steps S306;
S304: judge successfully to obtain the first web page resources;
S306: judge to obtain the first web page resources not successfully.
In general, browser or loader will be according to target webpage institutes during accessing to target webpage Corresponding web document pulls the first web page resources, and after successfully obtaining the first web page resources, is loaded into and is in In target webpage in present browser or user interface, thus, in embodiments of the present invention, the first web page resources can be passed through Load success or not judgement as a result, to determine whether success from CDN obtain the first web page resources, wherein if target webpage The first required web page resources are loaded successfully into target webpage, then may determine that load operation before client at Function obtains the first web page resources from CDN, if the first web page resources needed for target webpage are loaded into target webpage not successfully, The reason of then no matter loading unsuccessfully comes from the failure of the acquisition to the first web page resources in CDN or browser or loader Load failure can be considered as the first web page resources of acquisition that fail, so as to turn to backup network in step S206 The second web page resources of request.
It is worth noting that, in some embodiments of the invention, the load for the web page resources based on html label Mode, loading action synchronous with the acquisition request of web page resources can carry out, specifically, for example, for the first web page resources For the situation of Javascript script file, can by html label as follows to the Javascript script file into Row load:
<script src=″script.js″type=″text/javascript″charset=″utf-8″></script >,
Wherein, "<script></script>" can be used to indicate that in html label<script>label, which can With the file for defining script type, wherein
Type attribute can be used for providing the multipurpose internet mail extensions MIME (Multipurpose of the script file Internet Mail EXtensions) type, wherein " javascript " can be used to indicate that the type of the script file is Javascript script file;
Charset attribute can be used for providing the character code mode of the Javascript script file, for example, above-mentioned " utf-8 " can be used to indicate that Unicode coding mode;
Src attribute can be used for being directed toward external script files namely the Javascript script file, and can pass through The assignment of Src attribute provides the access path of the Javascript script file, wherein the access path is usually expressed as this The URL of Javascript script file, " script.js " as escribed above.
From the above, it can be seen that passing through above-mentioned html<script>label to as the first web page resources During Javascript script file is loaded, due to defining the Javascript script file by Src attribute Access path, and it can be accessed and be called according to the path, so as to be considered as while load to first Web page resources propose the request of acquisition.
It is worth noting that, for the loading method of the web page resources based on static html label, since it is difficult to The stress state of accurate judgement script, so that in some embodiments of the invention, JS (Javascript) load can be used Device loads Javascript script file, in the above scenario, as shown in figure 4, optionally, step S302 can wrap It includes:
S402: judge whether that the Javascript script file is successfully loaded into the target webpage by loader In.
Wherein, common JS loader has very much, for example, can be the loader based on script DOM mode, it can also Think the loader based on ajax eval mode and other feasible can be used for judging that Javascript script file is The loader that no success loads, this is not limited by the present invention.
Similarly, it is the situation of CSS file for the first web page resources, again may be by html label and it is added It carries, for example, the html label can be with are as follows:
< link rel=" stylesheet " href="/css/master.css " type=" text/css " Media=" screen " chaset=" utf-8 " >,
Wherein, "<link>" can be used to indicate that<link>label in html label, the label can be used for defining net Relationship between page document and the web page resources of outside, and it is commonly used for link shape table, such as CSS file, wherein
Type attribute can be used for providing the mime type of the external web page resource, wherein " text/css " can be used for Indicate that the linked web page resources are CSS file;
Rel attribute can be used for providing the linking relationship between above-mentioned web document and the CSS file, wherein " stylesheet " can be used to indicate that link shape table;
Media attribute can be used for providing that the linked CSS file will be shown in what kind of equipment, for example, Above-mentioned " screen " can be used to indicate that be shown in PC equipment;
Charset attribute can be used for providing the character code mode of the CSS file, for example, above-mentioned " utf-8 " can be with For indicating Unicode coding mode;
Href attribute can be used for defining the access path of the CSS script file, wherein the access path is usually expressed as The URL of the CSS file, "/css/master.css " as escribed above.
Similarly, by above-mentioned html<link>label the CSS file as the first web page resources is being loaded In the process, it due to defining the access path of the CSS file by Href attribute, and can be accessed according to the path to it And calling, the request of acquisition is proposed to the first web page resources while load so as to be considered as.
As shown in figure 5, being the situation of CSS file for the first web page resources, step S302 can in embodiments of the present invention To include:
S502: the predetermined time period after needing the first web page resources to be loaded into CDN request target webpage It is interior, judge in target webpage specify document dbject model DOM node whether successfully load recorded in CSS file with The corresponding the preset style of DOM node,
If so, S504 is thened follow the steps,
If it is not, thening follow the steps S506;
S504: judge successfully to load CSS file in target webpage;
S506: judge to load CSS file not successfully in target webpage.
Wherein, DOM is as a kind of standard programming interface, referring to its regulation, in embodiments of the present invention, in web document Each ingredient can be considered as a DOM node, for example, the DOM node can be the entirety of web document, or on That states is used to link the html label of external web page resource, can also be the web page element recorded in web document, such as wherein Text or html attribute, etc..
In embodiments of the present invention, it can be the specified pattern of one or more DOM node settings in CSS file, make For above-mentioned the preset style, and the indicator for successfully loading the CSS file is judged whether with the preset style, attempting to this After CSS file is loaded, whether successfully acted in target webpage according to indicator, to determine whether CSS file loads into Function.Specifically, for example, the sentence pair of the following form in CSS file can be passed through as one of optional embodiment DOM node is configured:
Object { visibility:hidden },
Wherein, whether visible visibility attribute can be used for regulation object element, wherein " hidden " can be used In indicating that the element is invisible, for example, being the situation of " head " for object, can set the pattern of title to can not See, so as to pass through the inspection of the pattern to the title in the predetermined time period after request loads the CSS file It surveys to judge whether the CSS file successfully loads, wherein if the title is invisible, may determine that CSS file successfully adds Carry, if the title as it can be seen that if may determine that CSS file loads not successfully.
It should be noted that in embodiments of the present invention, to the first web page resources, such as above-mentioned Javascript script text The load that part or CSS file carry out, it should be understood that the request of load, wherein above-mentioned Javascript script file or CSS text Part can be not stored in CDN, be loaded into target webpage not successfully after can also being obtained or be obtained by client not successfully, from And request failure can be considered as.For above-mentioned scene, it should not be construed as the description with technical solution of the present invention and form to conflict.
Furthermore it is noted that in the above-described embodiments, for the first web page resources load movement can with obtain The movement taken is synchronous to be carried out, however this has no effect on the implementation of web page resources acquisition methods according to an embodiment of the present invention, does not answer It is interpreted as foring with technical solution of the present invention and conflict, also should not be construed as constituting the present invention restriction, and still should be regarded as Within protection scope of the present invention.
The web page resources acquisition methods provided according to embodiments of the present invention can be according to step S204 in step S206 Judging result, not successfully obtain the first web page resources when, from other than the CDN backup network obtain with the first webpage provide Consistent second web page resources of the content in source.
In embodiments of the present invention, it except the first web page resources that can be stored in CDN, is stored in backup network Second web page resources, wherein the content of the second web page resources can be consistent with the first web page resources, for example, of the invention another In some embodiments, the backup that the second web page resources can be used as the first web page resources is stored in backup network, however this hair It is bright that this is not construed as limiting.
The situation of the first web page resources can not be obtained from CDN for above-mentioned client, it can be determined that go out failed to obtain the One web page resources, so as to obtain the second web page resources from the backup network other than CDN, wherein second in step S206 The backup that web page resources can be used as the first web page resources is stored in advance in above-mentioned backup network, in case the tune of target webpage With so as to form a kind of optional implementation environment of web page resources acquisition methods according to an embodiment of the present invention, such as Fig. 6 institute Show.
Similar to the first web page resources, the file format of the second web page resources, the information type for being included and its specific table Existing form can also there are many selections, it is however generally that, can be identical as the first web page resources, so that target webpage is can not be from When CDN obtains the first web page resources, it can be obtained by intimate consistent web page resources acquisition request and web page resources loading method It takes and loads the second web page resources.However this is not meant to that the present invention has made restriction to this, for example, of the invention some In embodiment, the second web page resources can also show as to the first web page resources optimize processing after be stored in backup network In web page resources, for example, the web page resources by compression processing or format optimization processing, consequently facilitating webpage in backup network The storage and management of resource.Certainly, above only a kind of example, the present invention are not limited in any way this.
On the other hand, the storaging medium as the second web page resources, backup network can also there are many implementation, The storage equipment that can be embodied in the network other than CDN, can also show as combination, the equipment group of multiple devices Conjunction is formed by computer domain or a wider computer network, the present invention are not limited in any way this.
In embodiments of the present invention, the concept of backup network can be corresponding with the second web page resources therein are pre-stored in, For example, the computer network for having the second web page resources can be considered as above-mentioned backup network.Certainly, on the other hand, back up Network is it may be specified beforehand that multiple second webpages for storing the backup as web page resources needed for target webpage provide Source, wherein optionally, backup network can specify as the network area where target webpage, thus can be to target webpage Under the premise of accessing, it can obtain relevant second web page resources in consolidated network region, and then reached raising net The technical effect of the reliability of access to web page.
Particularly, in some embodiments of the invention, backup network can also be appointed as in above-mentioned the first webpage of storage Other CDN except the CDN of resource, wherein the backup for the first web page resources stored in other above-mentioned CDN can be considered as Second web page resources can be realized to the from other above-mentioned CDN thus in the case of the first web page resources can not be obtained successfully The acquisition of two web page resources, wherein what other above-mentioned CDN also can be selected as being closer to the client of specified network area The combination of CDN node, so as under the premise of improving the reliability of web page access, further decrease since the first webpage provides Source, which fails, obtains the influence of caused webpage access speed decline.
However, it should be understood that technical solution of the present invention can also with known to those skilled in the art other are feasible Technological means be combined with each other,, can also be with for example, for the orientation of other above-mentioned CDN to obtain more preferably technical effect Pass through domain name system DNS (Domain Name System) Lai Shixian.It should be noted that similar to technical solution of the present invention Deformation, expand and its and the combinations of other common technology means be formed by technical solution and embodiment is regarded as in this hair Within the scope of bright protection.
As shown in fig. 6, in the above scenario, when client is difficult to obtain the first web page resources from CDN, can by from Consistent second web page resources of content with the first web page resources are obtained in backup network, are solved in the prior art when client hardly possible Be difficult to load corresponding with web page resources web page element in target webpage caused by when obtaining web page resources from CDN thus It is caused to be difficult to the technical issues of normally being accessed target webpage, realize that the technology normally accessed target webpage is imitated Fruit, and improve the reliability of web page access.
It should be noted that in embodiments of the present invention, the first above-mentioned web page resources should be considered as and send to CDN The corresponding concept of web page resources acquisition request, that is, the first web page resources are interpreted as with the webpage of load needed for target webpage The web page resources to CDN request on the basis of element, therefore, the web page resources in CDN are updated or other types Data processing after the change for the first web page resources that occurs, it is standby such as in the case of the first web page resources are deleted Consistent second web page resources corresponding with the deleted content of the first web page resources still saved in part network, it should be appreciated that To meet the second web page resources described in technical solution of the present invention, implementation condition of the invention is had no effect on, also should not be understood To constitute restriction to the present invention.
Optionally, as a kind of specific embodiment, as shown in fig. 7, in step S206, it is above-mentioned other than CDN Backup network is obtained may include: with consistent second web page resources of content of the first web page resources
S702: the first URL for being used to position the first web page resources is updated to the 2nd URL, wherein the 2nd URL is for fixed Position is pre-stored in the second web page resources in backup network;
S704: the second web page resources are obtained by the 2nd URL.
By above embodiments, a kind of implementation second web page resources being accurately positioned and further obtain is provided Mode can specifically be formed by being updated to the first URL for positioning the first web page resources, and after passing through update Access and acquisition of the 2nd URL realization to the second web page resources for position the second web page resources.
In embodiments of the present invention, the first URL and the 2nd URL is respectively used to the first web page resources of positioning and the second webpage money Source, in addition to this, the present invention are not limited in any way the concrete form of the first URL and the 2nd URL.
In addition, in embodiments of the present invention, the operation of update described in step S702 can also there are many mode, for example, As a kind of optional mode, can there be the number for recording the corresponding relationship between the first URL and the 2nd URL in client According to table, specifically, the two can be stored in above-mentioned tables of data correspondingly, and judge to pass through first not successfully in step S204 When URL obtains the first web page resources, the can be obtained from backup network by the 2nd URL corresponding with the first URL Two web page resources.
Certainly, above-described embodiment is provided as example, and limiting the invention, for example, in the embodiment of the present invention In, above-mentioned update operation can also be realized by other means, wherein optionally, as shown in figure 8, step S702 may include:
Domain name in first URL: being replaced with the Main Domain in the domain where target webpage by S802, to form the 2nd URL, In, the second web page resources are pre-stored in position corresponding with the 2nd URL in the domain where target webpage.
Step S802 will be described in detail by a specific embodiment below.
Wherein, the corresponding web document of target webpage carries out obtaining set access to the first web page resources in CDN Path namely the first URL can be as shown below:
Http:// cdn.com/myproject/js/10/abc.js,
Wherein, " http " can be used to indicate that Data Transport Protocol is hypertext transfer protocol http(Hypertext Transport Protocol);" cdn.com " is the domain name part in the first URL, can be indicated for storing the first webpage money The host address in source, " myproject/js/10/ " can be used to indicate that the position that the first web page resources are stored in above-mentioned host It sets, namely the path to access in the domain cdn.com to the first web page resources, " abc.js " can be used to indicate that first net The filename of page resource, wherein suffix " .js " can indicate that the type of this document is Javascript script file.
It, then, can will be above-mentioned according to step S802 assuming that the Main Domain in the domain where target webpage is " www.qq.com " First URL updates the 2nd URL being as follows:
Http:// www.qq.com/myproject/js/10/abc.js,
Be easily noted that, the domain name part " cdn.com " in the first URL is replaced by " www.qq.com ", if with this The corresponding position 2nd URL prestores the second web page resources, then can judge to pass through the first URL not successfully in step S204 It, can be by the 2nd URL from the main domain where target webpage after the first web page resources namely the abc.js file are obtained from CDN Obtain identical abc.js file.
It is worth noting that, in the above-described embodiments, the first web page resources and the second web page resources all can be abc.js File, however this should not be considered as foring with the first and second web page resources in technical solution of the present invention and conflict, and Ying Li Solution is the different web pages resource that content is identical but storage position is different.
In the above-described embodiments, since target webpage and the second web page resources are stored in same main domain, thus, if to mesh The request that mark webpage accesses can obtain the response of target webpage, then may generally be considered as the domain and decontroled visit to client Limitation is asked, so that can generally also succeed obtains the second web page resources out of same domain, finally to realize to target webpage Normal access.From the above, it can be seen that the web page resources acquisition methods provided according to embodiments of the present invention, can achieve and mention The technical effect of the reliability of high web page access.
Certainly, above only a kind of example, the present invention are not construed as limiting the implementation of step S802.
Optionally, as shown in figure 9, in embodiments of the present invention, step S206 may include:
S902: the second web page resources and third web page resources are obtained from backup network, wherein third web page resources are used for table Show also needs web page resources to be loaded in target webpage in addition to the first web page resources.
In embodiments of the present invention, if judging to load the first web page resources not successfully in step S204, can sentence Web page resources can not be obtained from the CDN where the first web page resources by being set to client, so as to according to step S902, above-mentioned It is obtained in backup network outside the second web page resources, can also obtain and also need to add in addition to the first web page resources in target webpage The third web page resources of load, to be omitted and be needed in target webpage on the basis of improving the reliability of web page access The whether successful deterministic process obtained of each of other web page resources of load, reduces processing pressure, and shorten The time is handled, the speed normally accessed target webpage is accelerated.
On the other hand, as shown in Figure 10, optionally, according to the judging result of step S204, if judging successfully to obtain First web page resources, above-mentioned web page resources acquisition methods can also include:
S1002: to third web page resources described in CDN request.
In embodiments of the present invention, it if judging successfully to load the first web page resources in step S204, can be determined that Web page resources can be obtained from the CDN where the first web page resources for client, so as to according to step S1002, to the CDN The above-mentioned third web page resources of request.Wherein, may be used also in some embodiments of the invention as a kind of optional mode Third web page resources are further repeated the net provided according to embodiments of the present invention as the first new web page resources Page resource acquiring method, so as under the advantage of the content distribution function using CDN, it is ensured that the positive frequentation of target webpage It asks.
More specifically, as an alternative embodiment, can be used for according to the generation of the judging result of step S204 Indicate the successful or unsuccessful identification item for obtaining the first web page resources, for example, the identification item can be specific cookie, thus In the loading procedure of third web page resources, it can select still to ask from backup network from CDN by the identification to the identification item It asks and obtains third web page resources.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, computer, clothes Business device or the network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.
Embodiment 2
According to embodiments of the present invention, a kind of web page resources for implementing above-mentioned web page resources acquisition methods are additionally provided to obtain Take device.As shown in figure 11, the apparatus may include:
1) access unit 1102, for being accessed according to web access requests to target webpage, and to CDN request Need to load the first web page resources in target webpage;
2) judging unit 1104 successfully obtain the first web page resources for judging whether;
3) first acquisition unit 1106 are used for when obtaining the first web page resources not successfully, from the backup network other than CDN Obtain consistent second web page resources of content with the first web page resources.
The web page resources acquisition device provided according to embodiments of the present invention can be according to webpage in access unit 1102 Access request accesses to target webpage, and needs the first webpage loaded in the target webpage to CDN request Resource.
In general, in embodiments of the present invention, the above-mentioned web access requests to target webpage usually may come from The identification clicked to the link of the direction target webpage in browser or user interface, also, one kind as Internet resources, The web page files of above-mentioned target webpage can usually be positioned by URL, for example, in some embodiments of the invention, it is right There are the capture and identification of the mouse click action on the passage of URL hyperlink in above-mentioned browser or user interface To form web access requests.Certainly, the link of above-mentioned direction target webpage can also be not present on text, but schemed On element in other browsers such as mark, picture, video pictures or user interface, this is not limited by the present invention.
It is worth noting that, being a kind of relatively conventional performance shape of web access requests described in above-described embodiment Formula, and the embodiment of not necessarily, for example, in some embodiments of the invention, the generations of web access requests can also be with The input signal for reading from computer input device is unrelated, for example, the web access requests can be by being currently running in client Application automatically generate, with formed to the pop-up page on browser or user interface, such as the access of navigation page, the present invention couple This is not limited in any way.
Based on the above-mentioned access request to target webpage, the access to target webpage may be implemented, however, since format limits System, web document itself corresponding with target webpage are typically not enough to cover all information content of presentation needed for it.
In general, target webpage can usually show as the web document of html format, and can be by the webpage Different elements, such as text, image, audio, video, interactive form for being edited in document etc. define the tool of target webpage Body presentation mode so as to show different types of information in webpage, and realizes the interaction with external information.
Wherein, a part of inside that can be directly recorded in above-mentioned web document in above-mentioned web page element, by loader, Browser or user interface etc. are loaded directly into, and another part can utilize web document in such a way that external resource links The calling to these web page resources is realized in the chained address of the web page resources of the outside for being present in the web document of middle record, And be further advanced by loader, browser or user interface etc. and be loaded into target webpage, to constitute above-mentioned web page element.Its In, the chained address of above-mentioned web page resources can generally also show as URL, however this is not limited by the present invention.
As previously mentioned, in the prior art, the web page resources of the above-mentioned outside for being present in web document can be stored in Data link is shorter between web page access terminal, on node of the faster CDN of data transmission bauds, wherein the node can be used In indicating a domain in computer network, it can also indicate that a computer or server therein etc. have basic data The storaging medium of processing function.Wherein, above-mentioned be stored in CDN node can be used for mesh convenient for following description The web page resources of mark webpage load are denoted as the first web page resources.
Specifically, corresponding with above-mentioned web page element, the first web page resources can also there are many type, such as text, picture, Video file etc., and its file format can also there are many, for example, relatively conventional, may include Javascript script or The file etc. of CSS type, the present invention do not do any restriction to this, it is thus understood that feasible any form of web page resources.
It is worth noting that, in embodiments of the present invention, target webpage can be remembered according in corresponding web document The URL of first web page resources of record calls first web page resources, however the first web page resources corresponding with the URL might not Necessarily be stored in scheduled position in CDN, for example, by the data dump of CDN server or update operation, can by this first Web page resources are deleted from CDN, or are updated and arrived other addresses or path, that is, in some embodiments of the invention, client Can be to the first web page resources of CDN request, however first web page resources can also be not present in above-mentioned CDN.It needs Illustrate, above-mentioned scene has no effect on the implementation of technical solution of the present invention, also should not be construed as constituting the present invention any It limits.
The web page resources acquisition device provided according to embodiments of the present invention, as shown in Fig. 2, in judging unit 1104, it can To judge whether successfully to obtain first web page resources after above-mentioned the first web page resources to CDN request.
In general, the acquisition request of above-mentioned first web page resources can be shown as through corresponding URL to first The access of web page resources is called in other words, wherein for ease of description, by the above-mentioned chained address for being used to position the first web page resources It is defined as the first URL.
Specifically, in the above scenario, CDN for the response of above-mentioned web page resources acquisition request generally may include with Lower four kinds of situations:
1) CDN responds web page resources acquisition request, and sends client for the first web page resources;
2) CDN responds web page resources acquisition request, and there are the first web page resources corresponding with the first URL, but Client is sent by the first web page resources not successfully;
3) CDN responds web page resources acquisition request, but the first web page resources corresponding with the first URL are not present;
4) CDN does not respond web page resources acquisition request.
Wherein, for the first situation, it can be determined that going out successfully to obtain first web page resources namely client can be with Web page resources normally are obtained from CDN and realize the access to complete target webpage, obtain webpage money from CDN in view of client The scheme in source belongs to technical solution mature in the prior art, and the present invention does not make tired state herein.
For second case, specifically, in some embodiments of the invention, can pacify from the network of client Full setting, such as firewall, downloading shielding, the limitation of resource access being arranged in client or the domain locating for it etc., to lead Cause CDN after the acquisition request for receiving the first web page resources, the browsing that the first web page resources can not be sent in client Device or user interface etc., so as to judge to obtain first web page resources not successfully.
For the third situation, as previously mentioned, in some embodiments of the invention, the first web page resources can be stored in Position other than first URL, for example, the access path of the first URL is changed in the update operation of CDN server, Deng the first web page resources can not be sent to client so as to cause CDN, also may determine that obtain first net not successfully Page resource.
It, specifically, in some embodiments of the invention, can be from storage the first webpage money for the 4th kind of situation The access of node in the CDN in source is arranged, for example, visit of the user other than the white list for forbidding the node to be arranged to the node It asks, fails to make a response the acquisition request of the first web page resources so as to cause CDN, should also be judged as and obtain described not successfully One web page resources.
For above situation, it can be judged respectively to obtain whether successfully obtain first web page resources Judging result, however, on the other hand, the above-mentioned judgement operation for whether successfully obtaining first web page resources can also with Family setting is unrelated with network environment, for example can be monitored in the port that client is specified, and is sending web page resources with detection After acquisition request, if success receives the first web page resources from CDN.
Certainly, above embodiments are a kind of example, in embodiments of the present invention, can also by other means to whether Success obtains the first web page resources and is judged that optionally, as shown in figure 12, judging unit 1104 may include:
1) the first web page resources are successfully loaded into target webpage by judgment module 1202 for judging whether;Wherein, if First web page resources are loaded into target webpage by success, then judge successfully to obtain the first web page resources;If not successfully by One web page resources are loaded into target webpage, then judge to obtain the first web page resources not successfully.
In general, browser or loader will be according to target webpage institutes during accessing to target webpage Corresponding web document pulls the first web page resources, and after successfully obtaining the first web page resources, is loaded into and is in In target webpage in present browser or user interface, thus, in embodiments of the present invention, the first web page resources can be passed through Load success or not judgement as a result, to determine whether success from CDN obtain the first web page resources, wherein if target webpage The first required web page resources are loaded successfully into target webpage, then may determine that load operation before client at Function obtains the first web page resources from CDN, if the first web page resources needed for target webpage are loaded into target webpage not successfully, The reason of then no matter loading unsuccessfully comes from the failure of the acquisition to the first web page resources in CDN or browser or loader Load failure can be considered as the first web page resources of acquisition that fail, so as to turn in first acquisition unit 1106 The second web page resources of backup network request.
It is worth noting that, in some embodiments of the invention, the load for the web page resources based on html label Mode, loading action synchronous with the acquisition request of web page resources can carry out, specifically, for example, for the first web page resources For the situation of Javascript script file, can by html label as follows to the Javascript script file into Row load:
<script src=″script.js″type=″text/javascript″charset=″utf-8″></script >,
Wherein, "<script></script>" can be used to indicate that in html label<script>label, which can With the file for defining script type, wherein
Type attribute can be used for providing the mime type of the script file, wherein " javascript " can be used for table The type for showing the script file is Javascript script file;
Charset attribute can be used for providing the character code mode of the Javascript script file, for example, above-mentioned " utf-8 " can be used to indicate that Unicode coding mode;
Src attribute can be used for being directed toward external script files namely the Javascript script file, and can pass through The assignment of Src attribute provides the access path of the Javascript script file, wherein the access path is usually expressed as this The URL of Javascript script file, " script.js " as escribed above.
From the above, it can be seen that passing through above-mentioned html<script>label to as the first web page resources During Javascript script file is loaded, due to defining the Javascript script file by Src attribute Access path, and it can be accessed and be called according to the path, so as to be considered as while load to first Web page resources propose the request of acquisition.
It is worth noting that, for the loading method of the web page resources based on static html label, since it is difficult to The stress state of accurate judgement script, so that in some embodiments of the invention, JS loader pair can be used Javascript script file is loaded, and in the above scenario, as shown in figure 13, judgment module 1202 may include:
1) judging submodule 1302, for judging whether successfully to be loaded into Javascript script file by loader In target webpage.
Wherein, common JS loader has very much, for example, can be the loader based on script DOM mode, it can also Think the loader based on ajax eval mode and other feasible can be used for judging that Javascript script file is The loader that no success loads, this is not limited by the present invention.
Similarly, it is the situation of CSS file for the first web page resources, again may be by html label and it is added It carries, for example, the html label can be with are as follows:
<link rel=″stylesheet″href=″/css/master.css″type=″text/css″media=″ Screen " charset=" utf-8 " >,
Wherein, "<link>" can be used to indicate that<link>label in html label, the label can be used for defining net Relationship between page document and the web page resources of outside, and it is commonly used for link shape table, such as CSS file, wherein
Type attribute can be used for providing the mime type of the external web page resource, wherein " text/css " can be used for Indicate that the linked web page resources are CSS file;
Rel attribute can be used for providing the linking relationship between above-mentioned web document and the CSS file, wherein " stylesheet " can be used to indicate that link shape table;
Media attribute can be used for providing that the linked CSS file will be shown in what kind of equipment, for example, Above-mentioned " screen " can be used to indicate that be shown in PC equipment;
Charset attribute can be used for providing the character code mode of the CSS file, for example, above-mentioned " utf-8 " can be with For indicating Unicode coding mode;
Href attribute can be used for defining the access path of the CSS script file, wherein the access path is usually expressed as The URL of the CSS file, "/css/master.css " as escribed above.
Similarly, by above-mentioned html<link>label the CSS file as the first web page resources is being loaded In the process, it due to defining the access path of the CSS file by Href attribute, and can be accessed according to the path to it And calling, the request of acquisition is proposed to the first web page resources while load so as to be considered as.
It as shown in figure 14, in embodiments of the present invention, is the situation of CSS file, judgment module for the first web page resources 1202 may include:
1) judging submodule 1402, after needing the first web page resources to be loaded in CDN request target webpage Predetermined time period in, judge in target webpage specify document dbject model DOM node whether successfully loaded CSS text The preset style corresponding with DOM node recorded in part;Wherein,
If DOM node successfully loads the preset style in predetermined time period, the success in target webpage is judged Load CSS file;
If DOM node loads the preset style not successfully in predetermined time period, judge in target webpage not at Function loads CSS file.
Wherein, DOM is as a kind of standard programming interface, referring to its regulation, in embodiments of the present invention, in web document Each ingredient can be considered as a DOM node, for example, the DOM node can be the entirety of web document, or on That states is used to link the html label of external web page resource, can also be the web page element recorded in web document, such as wherein Text or html attribute, etc..
In embodiments of the present invention, it can be the specified pattern of one or more DOM node settings in CSS file, make For above-mentioned the preset style, and the indicator for successfully loading the CSS file is judged whether with the preset style, attempting to this After CSS file is loaded, whether successfully acted in target webpage according to indicator, to determine whether CSS file loads into Function.Specifically, for example, the sentence pair of the following form in CSS file can be passed through as one of optional embodiment DOM node is configured:
Object { visibility:hidden },
Wherein, whether visible visibility attribute can be used for regulation object element, wherein " hidden " can be used In indicating that the element is invisible, for example, being the situation of " head " for object, can set the pattern of title to can not See, so as to pass through the inspection of the pattern to the title in the predetermined time period after request loads the CSS file It surveys to judge whether the CSS file successfully loads, wherein if the title is invisible, may determine that CSS file successfully adds Carry, if the title as it can be seen that if may determine that CSS file loads not successfully.
It should be noted that in embodiments of the present invention, to the first web page resources, such as above-mentioned Javascript script text The load that part or CSS file carry out, it should be understood that the request of load, wherein above-mentioned Javascript script file or CSS text Part can be not stored in CDN, be loaded into target webpage not successfully after can also being obtained or be obtained by client not successfully, from And request failure can be considered as.For above-mentioned scene, it should not be construed as the description with technical solution of the present invention and form to conflict.
Furthermore it is noted that in the above-described embodiments, for the first web page resources load movement can with obtain The movement taken is synchronous to be carried out, however this has no effect on the implementation of web page resources acquisition device according to an embodiment of the present invention, does not answer It is interpreted as foring with technical solution of the present invention and conflict, also should not be construed as constituting the present invention restriction, and still should be regarded as Within protection scope of the present invention.
The web page resources acquisition device provided according to embodiments of the present invention can basis in first acquisition unit 1106 The judging result of judging unit 1104 is obtained when obtaining the first web page resources not successfully from the backup network other than the CDN With consistent second web page resources of content of the first web page resources.
In embodiments of the present invention, it except the first web page resources that can be stored in CDN, is stored in backup network Second web page resources, wherein the content of the second web page resources can be consistent with the first web page resources, for example, of the invention another In some embodiments, the backup that the second web page resources can be used as the first web page resources is stored in backup network, however this hair It is bright that this is not construed as limiting.
The situation of the first web page resources can not be obtained from CDN for above-mentioned client, it can be determined that go out failed to obtain the One web page resources, so as to obtain the second web page resources from the backup network other than CDN in first acquisition unit 1106, Wherein, the backup that the second web page resources can be used as the first web page resources is stored in advance in above-mentioned backup network, in case target The calling of webpage, the optional implementation ring of one kind so as to form web page resources acquisition device according to an embodiment of the present invention Border, as shown in Figure 6.
Similar to the first web page resources, the file format of the second web page resources, the information type for being included and its specific table Existing form can also there are many selections, it is however generally that, can be identical as the first web page resources, so that target webpage is can not be from When CDN obtains the first web page resources, it can be obtained by intimate consistent web page resources acquisition request and web page resources loading method It takes and loads the second web page resources.However this is not meant to that the present invention has made restriction to this, for example, of the invention some In embodiment, the second web page resources can also show as to the first web page resources optimize processing after be stored in backup network In web page resources, for example, the web page resources by compression processing or format optimization processing, consequently facilitating webpage in backup network The storage and management of resource.Certainly, above only a kind of example, the present invention are not limited in any way this.
On the other hand, the storaging medium as the second web page resources, backup network can also there are many implementation, The storage equipment that can be embodied in the network other than CDN, can also show as combination, the equipment group of multiple devices Conjunction is formed by computer domain or a wider computer network, the present invention are not limited in any way this.
In embodiments of the present invention, the concept of backup network can be corresponding with the second web page resources therein are pre-stored in, For example, the computer network for having the second web page resources can be considered as above-mentioned backup network.Certainly, on the other hand, back up Network is it may be specified beforehand that multiple second webpages for storing the backup as web page resources needed for target webpage provide Source, wherein optionally, backup network can specify as the network area where target webpage, thus can be to target webpage Under the premise of accessing, it can obtain relevant second web page resources in consolidated network region, and then reached raising net The technical effect of the reliability of access to web page.
Particularly, in some embodiments of the invention, backup network can also be appointed as in above-mentioned the first webpage of storage Other CDN except the CDN of resource, wherein the backup for the first web page resources stored in other above-mentioned CDN can be considered as Second web page resources can be realized to the from other above-mentioned CDN thus in the case of the first web page resources can not be obtained successfully The acquisition of two web page resources, wherein what other above-mentioned CDN also can be selected as being closer to the client of specified network area The combination of CDN node, so as under the premise of improving the reliability of web page access, further decrease since the first webpage provides Source, which fails, obtains the influence of caused webpage access speed decline.
However, it should be understood that technical solution of the present invention can also with known to those skilled in the art other are feasible Technological means be combined with each other,, can also be with for example, for the orientation of other above-mentioned CDN to obtain more preferably technical effect Pass through domain name analysis system DNS(Domain Name System) Lai Shixian.It should be noted that similar to the technology of the present invention Scheme deformation, expand and its and the combinations of other common technology means be formed by technical solution and embodiment is regarded as Within the scope of protection of the invention.
As shown in fig. 6, in the above scenario, when client is difficult to obtain the first web page resources from CDN, can by from Consistent second web page resources of content with the first web page resources are obtained in backup network, are solved in the prior art when client hardly possible Be difficult to load corresponding with web page resources web page element in target webpage caused by when obtaining web page resources from CDN thus It is caused to be difficult to the technical issues of normally being accessed target webpage, realize that the technology normally accessed target webpage is imitated Fruit, and improve the reliability of web page access.
It should be noted that in embodiments of the present invention, the first above-mentioned web page resources should be considered as and send to CDN The corresponding concept of web page resources acquisition request, that is, the first web page resources are interpreted as with the webpage of load needed for target webpage The web page resources to CDN request on the basis of element, therefore, the web page resources in CDN are updated or other types Data processing after the change for the first web page resources that occurs, it is standby such as in the case of the first web page resources are deleted Consistent second web page resources corresponding with the deleted content of the first web page resources still saved in part network, it should be appreciated that To meet the second web page resources described in technical solution of the present invention, implementation condition of the invention is had no effect on, also should not be understood To constitute restriction to the present invention.
Optionally, as a kind of specific embodiment, as shown in figure 15, first acquisition unit 1106 may include:
1) update module 1502, the first uniform resource position mark URL for that will be used to position the first web page resources update For the 2nd URL, wherein the 2nd URL is for positioning the second web page resources being pre-stored in backup network;
2) first module 1504 is obtained, for obtaining the second web page resources by the 2nd URL.
By above embodiments, a kind of implementation second web page resources being accurately positioned and further obtain is provided Mode can specifically be formed by being updated to the first URL for positioning the first web page resources, and after passing through update Access and acquisition of the 2nd URL realization to the second web page resources for position the second web page resources.
In embodiments of the present invention, the first URL and the 2nd URL is respectively used to the first web page resources of positioning and the second webpage money Source, in addition to this, the present invention are not limited in any way the concrete form of the first URL and the 2nd URL.
In addition, in embodiments of the present invention, the operation of update performed by update module 1502 can also there are many mode, examples Such as, as a kind of optional mode, can have in client for recording the corresponding relationship between the first URL and the 2nd URL Tables of data, specifically, the two can be stored in above-mentioned tables of data correspondingly, and judge in judging unit 1104 failed It, can be by twoth URL corresponding with the first URL from backup network when obtaining the first web page resources by the first URL The second web page resources of middle acquisition.
Certainly, above-described embodiment is provided as example, and limiting the invention, for example, in the embodiment of the present invention In, above-mentioned update operation can also be realized by other means, wherein optionally, as shown in figure 16, update module 1502 can be with Include:
1) submodule 1602 is updated, for the domain name in the first URL to be replaced with to the Main Domain in the domain where target webpage, To form the 2nd URL, wherein the second web page resources are pre-stored in position corresponding with the 2nd URL in the domain where target webpage.
It will be described in detail below by a specific embodiment to submodule 1602 is updated.
Wherein, the corresponding web document of target webpage carries out obtaining set access to the first web page resources in CDN Path namely the first URL can be as shown below:
Http:// cdn.com/myproject/js/10/abc.js,
Wherein, " http " can be used to indicate that Data Transport Protocol is hypertext transfer protocol http(Hypertext Transport Protocol);" cdn.com " is the domain name part in the first URL, can be indicated for storing the first webpage money The host address in source, " myproject/js/10/ " can be used to indicate that the position that the first web page resources are stored in above-mentioned host It sets, namely the path to access in the domain cdn.com to the first web page resources, " abc.js " can be used to indicate that first net The filename of page resource, wherein suffix " .js " can indicate that the type of this document is Javascript script file.
Assuming that the Main Domain in the domain where target webpage is that " www.qq.com " can be with then in updating submodule 1602 Above-mentioned first URL is updated to the 2nd URL being as follows:
Http:// www.qq.com/myproject/js/10/abc.js,
Be easily noted that, the domain name part " cdn.com " in the first URL is replaced by " www.qq.com ", if with this The corresponding position 2nd URL prestores the second web page resources, then can judge in judging unit 1104 not successfully by the One URL, can be by the 2nd URL where target webpage after CDN the first web page resources of acquisition namely the abc.js file Main domain obtains identical abc.js file.
It is worth noting that, in the above-described embodiments, the first web page resources and the second web page resources all can be abc.js File, however this should not be considered as foring with the first and second web page resources in technical solution of the present invention and conflict, and Ying Li Solution is the different web pages resource that content is identical but storage position is different.
In the above-described embodiments, since target webpage and the second web page resources are stored in same main domain, thus, if to mesh The request that mark webpage accesses can obtain the response of target webpage, then may generally be considered as the domain and decontroled visit to client Limitation is asked, so that can generally also succeed obtains the second web page resources out of same domain, finally to realize to target webpage Normal access.From the above, it can be seen that the web page resources acquisition device provided according to embodiments of the present invention, can achieve and mention The technical effect of the reliability of high web page access.
Certainly, above only a kind of example, the present invention are not construed as limiting the implementation of update module 1502.
Optionally, as shown in figure 17, in embodiments of the present invention, first acquisition unit 1106 may include:
1) second module 1702 is obtained, for obtaining the second web page resources and third web page resources from backup network, wherein Third web page resources also need web page resources to be loaded for indicating in target webpage in addition to the first web page resources.
It in embodiments of the present invention, can if judging to load the first web page resources not successfully in judging unit 1104 To be determined as that client can not obtain web page resources from the CDN where the first web page resources, so as to obtain mould according to second Block 1702 is obtained in above-mentioned backup network outside the second web page resources, can also be obtained in target webpage except the first webpage provides Third web page resources to be loaded are also needed except source, to be omitted and be directed on the basis of improving the reliability of web page access The whether successful deterministic process obtained of each of other web page resources to be loaded is needed in target webpage, reduces processing pressure Power, and the processing time is shortened, accelerate the speed normally accessed target webpage.
On the other hand, as shown in figure 18, optionally, according to the judging result of judging unit 1104, if judging success The first web page resources are obtained, above-mentioned web page resources acquisition device can also include:
1) second acquisition unit 1802, for when target webpage successfully obtains the first web page resources, to CDN request Third web page resources.
It in embodiments of the present invention, can be with if judging successfully to load the first web page resources in judging unit 1104 It is determined as that client can obtain web page resources from the CDN where the first web page resources, so as to according to second acquisition unit 1802, to the above-mentioned third web page resources of the CDN request.Wherein, as a kind of optional mode, in some realities of the invention It applies in example, further third web page resources can also be repeated as the first new web page resources and implemented according to the present invention The web page resources acquisition device that example provides, so as under the advantage of the content distribution function using CDN, it is ensured that target webpage Normal access.
More specifically, as an alternative embodiment, can be generated according to the judging result of judging unit 1104 It is used to indicate the successful or unsuccessful identification item for obtaining the first web page resources, for example, the identification item can be specific cookie, To be selected from CDN by the identification to the identification item still from backup net in the loading procedure of third web page resources Network request third web page resources.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
In the above embodiment of the invention, it all emphasizes particularly on different fields to the description of each embodiment, does not have in some embodiment The part of detailed description, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed client, it can be by others side Formula is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of the unit, and only one Kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or It is desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed it is mutual it Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of unit or module It connects, can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words It embodies, which is stored in a storage medium, including some instructions are used so that a computer Equipment (can for personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or Part steps.And storage medium above-mentioned includes: that USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic or disk etc. be various to can store program code Medium.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (17)

1. a kind of web page resources acquisition methods characterized by comprising
It is accessed according to web access requests to target webpage, and needs to load to content distributing network CDN request The first web page resources in the target webpage;
Judge whether successfully to obtain first web page resources;
If obtaining first web page resources not successfully and described to obtain first web page resources not successfully being due to described Caused by CDN forbids access of the user to the CDN other than the white list of the CDN setting, then from standby other than the CDN Part network obtains consistent second web page resources of content with first web page resources, wherein the backup network is described One or more storage equipment other than CDN, the backup network are located at the network area where the target webpage.
2. the method according to claim 1, wherein described judge whether successfully to obtain first web page resources Include:
Judge whether that successfully first web page resources are loaded into the target webpage;
If successfully first web page resources are loaded into the target webpage, judge successfully to obtain first webpage Resource;
If first web page resources are loaded into the target webpage not successfully, judge to obtain described first not successfully Web page resources.
3. according to the method described in claim 2, it is characterized in that, first web page resources are Javascript script text Part, wherein it is described judge whether that successfully first web page resources are loaded into the target webpage include:
By loader judge whether that successfully the Javascript script file is loaded into the target webpage.
4. according to the method described in claim 2, it is characterized in that, first web page resources be cascading style sheets CSS file, Wherein, it is described judge whether that successfully first web page resources are loaded into the target webpage include:
Predetermined time period after needing from the first web page resources to be loaded to target webpage described in the CDN request It is interior, judge whether the document dbject model DOM node specified in the target webpage has successfully loaded and remembers in the CSS file The preset style corresponding with the DOM node of record;
If the DOM node successfully loads described the preset style in the predetermined time period, judge in the mesh The CSS file is successfully loaded in mark webpage;
If the DOM node loads described the preset style not successfully in the predetermined time period, judge in the mesh The CSS file is loaded not successfully in mark webpage.
5. method according to claim 1 to 4, which is characterized in that the backup net from other than the CDN Network is obtained includes: with consistent second web page resources of content of first web page resources
The first uniform resource position mark URL for being used to position first web page resources is updated to the 2nd URL, wherein described 2nd URL is for positioning second web page resources being pre-stored in the backup network;
Second web page resources are obtained by the 2nd URL.
6. according to the method described in claim 5, it is characterized in that, described will be used to position the first of first web page resources URL is updated to the 2nd URL
Domain name in first URL is replaced with to the Main Domain in the domain where the target webpage, to form described second URL, wherein second web page resources are pre-stored in position corresponding with the 2nd URL in the domain where the target webpage.
7. method according to claim 1 to 4, which is characterized in that the backup net from other than the CDN Network is obtained includes: with consistent second web page resources of content of first web page resources
Second web page resources and third web page resources are obtained from the backup network, wherein the third web page resources are used Web page resources to be loaded are also needed in addition to first web page resources in the target webpage in expression.
8. the method according to the description of claim 7 is characterized in that judging whether successfully to obtain the first webpage money described After source, further includes:
If the target webpage successfully obtains first web page resources, provided to third webpage described in the CDN request Source.
9. a kind of web page resources acquisition device characterized by comprising
Access unit needs to load for accessing to target webpage according to web access requests, and to CDN request The first web page resources in the target webpage;
Judging unit successfully obtains first web page resources for judging whether;
First acquisition unit, for obtaining first web page resources not successfully and described obtaining first net not successfully When page resource is caused by access of the user to the CDN forbidden other than the white list of the CDN setting as the CDN, Consistent second web page resources of content with first web page resources are obtained from the backup network other than the CDN, wherein institute Stating backup network is one or more storage equipment other than the CDN, and the backup network is located at the target webpage institute Network area.
10. device according to claim 9, which is characterized in that the judging unit includes:
First web page resources are successfully loaded into the target webpage by judgment module for judging whether;
Wherein, if successfully first web page resources are loaded into the target webpage, judge successfully to obtain described One web page resources;If first web page resources are loaded into the target webpage not successfully, judge to obtain not successfully First web page resources.
11. device according to claim 10, which is characterized in that first web page resources are Javascript script text Part, wherein the judgment module includes:
The Javascript script file is successfully loaded into the mesh for judging whether by loader by judging submodule It marks in webpage.
12. device according to claim 10, which is characterized in that first web page resources are cascading style sheets CSS text Part, wherein the judgment module includes:
Judging submodule, for after needing the first web page resources to be loaded into target webpage described in the CDN request Predetermined time period in, judge in the target webpage specify document dbject model DOM node whether successfully loaded The preset style corresponding with the DOM node recorded in the CSS file;Wherein,
If the DOM node successfully loads described the preset style in the predetermined time period, judge in the mesh The CSS file is successfully loaded in mark webpage;
If the DOM node loads described the preset style not successfully in the predetermined time period, judge in the mesh The CSS file is loaded not successfully in mark webpage.
13. the device according to any one of claim 9 to 12, which is characterized in that the first acquisition unit includes:
Update module, the first uniform resource position mark URL for that will be used to position first web page resources are updated to second URL, wherein the 2nd URL is for positioning second web page resources being pre-stored in the backup network;
First obtains module, for obtaining second web page resources by the 2nd URL.
14. device according to claim 13, which is characterized in that the update module includes:
Submodule is updated, for the domain name in the first URL to be replaced with to the Main Domain in the domain where the target webpage, with Form the 2nd URL, wherein second web page resources are pre-stored in the domain where the target webpage and described second The corresponding position URL.
15. the device according to any one of claim 9 to 12, which is characterized in that the first acquisition unit includes:
Second obtains module, for obtaining second web page resources and third web page resources from the backup network, wherein institute State third web page resources for indicate also need webpage to be loaded in addition to first web page resources in the target webpage Resource.
16. device according to claim 15, which is characterized in that further include:
Second acquisition unit, for when the target webpage successfully obtains first web page resources, Xiang Suoshu CDN request to be obtained Take the third web page resources.
17. a kind of computer-readable storage medium, which is characterized in that it is stored with computer program in the storage medium, In, the computer program is arranged to execute method described in any one of claim 1 to 8 when operation.
CN201310367699.0A 2013-08-21 2013-08-21 Web page resources acquisition methods and device Active CN104426925B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310367699.0A CN104426925B (en) 2013-08-21 2013-08-21 Web page resources acquisition methods and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310367699.0A CN104426925B (en) 2013-08-21 2013-08-21 Web page resources acquisition methods and device

Publications (2)

Publication Number Publication Date
CN104426925A CN104426925A (en) 2015-03-18
CN104426925B true CN104426925B (en) 2019-11-08

Family

ID=52974857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310367699.0A Active CN104426925B (en) 2013-08-21 2013-08-21 Web page resources acquisition methods and device

Country Status (1)

Country Link
CN (1) CN104426925B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106407339A (en) * 2016-09-05 2017-02-15 用友优普信息技术有限公司 Hyper text markup language (HTML) file distributed releasing method and HTML file distributed releasing apparatus
CN106331160A (en) * 2016-09-28 2017-01-11 乐视控股(北京)有限公司 Data migration method and system
CN108737133A (en) * 2017-04-14 2018-11-02 艺龙网信息技术(北京)有限公司 Method and device for CDN static network reparations
CN107943921B (en) * 2017-11-21 2024-01-05 腾讯数码(天津)有限公司 Page sharing information generation method and device, computer equipment and storage medium
CN109474668B (en) * 2018-10-16 2022-03-04 平安科技(深圳)有限公司 CDN service switching method and device, computer equipment and storage medium
CN109284472B (en) * 2018-11-15 2022-06-07 福建省华渔教育科技有限公司 Front-end webpage loading method and storage medium based on webpack
CN109670131A (en) * 2018-12-18 2019-04-23 网宿科技股份有限公司 The processing of Resource Description File, the acquisition methods of page resource and intermediate server
CN109714406B (en) * 2018-12-18 2021-04-02 网宿科技股份有限公司 Method and equipment for processing resource description file and acquiring page resource
CN109726339A (en) * 2018-12-19 2019-05-07 西安四叶草信息技术有限公司 Resource request method and equipment
CN109857649B (en) * 2019-01-14 2022-07-26 珠海金山网络游戏科技有限公司 Resource testing method and system
CN111314437B (en) * 2020-01-20 2021-10-15 腾讯科技(深圳)有限公司 Resource package downloading method and device, storage medium and electronic device
CN111737617A (en) * 2020-06-15 2020-10-02 北京达佳互联信息技术有限公司 Page resource loading method and device, electronic equipment and storage medium
CN112685097B (en) * 2020-12-28 2024-04-16 北京达佳互联信息技术有限公司 Data processing method and device
CN114553961A (en) * 2022-01-06 2022-05-27 厦门游动网络科技有限公司 Method, system, device and medium for automatically refreshing global CDN

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546774A (en) * 2011-12-27 2012-07-04 厦门市美亚柏科信息股份有限公司 CDN (content distribution network) routing method for secondary redirection and system
CN102868935A (en) * 2012-08-24 2013-01-09 乐视网信息技术(北京)股份有限公司 Scheduling method for responding multiple sources in content distribution network (CDN)
CN103051976A (en) * 2013-01-22 2013-04-17 中兴通讯股份有限公司 Method, system and equipment for distributing HLS (HyperText Transfer Protocol Living Steaming) content by CDN (Content Distribute Network)
CN103248707A (en) * 2013-05-22 2013-08-14 北京奇虎科技有限公司 File access method, system and equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546774A (en) * 2011-12-27 2012-07-04 厦门市美亚柏科信息股份有限公司 CDN (content distribution network) routing method for secondary redirection and system
CN102868935A (en) * 2012-08-24 2013-01-09 乐视网信息技术(北京)股份有限公司 Scheduling method for responding multiple sources in content distribution network (CDN)
CN103051976A (en) * 2013-01-22 2013-04-17 中兴通讯股份有限公司 Method, system and equipment for distributing HLS (HyperText Transfer Protocol Living Steaming) content by CDN (Content Distribute Network)
CN103248707A (en) * 2013-05-22 2013-08-14 北京奇虎科技有限公司 File access method, system and equipment

Also Published As

Publication number Publication date
CN104426925A (en) 2015-03-18

Similar Documents

Publication Publication Date Title
CN104426925B (en) Web page resources acquisition methods and device
EP2724251B1 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US9060007B2 (en) System and methods for facilitating the synchronization of data
US10880391B2 (en) Method and apparatus for relaying session information from a portal server
US10542123B2 (en) System and method for generating and monitoring feedback of a published webpage as implemented on a remote client
US20140136944A1 (en) Real time web development testing and reporting system
US9864671B1 (en) Systems and methods of live experimentation on content provided by a web site
CN111104635B (en) Method and device for generating form webpage
US20180191798A1 (en) Methods and systems for server-side rendering of native content for presentation
CN106484383A (en) page rendering method, device and equipment
CN103412890A (en) Webpage loading method and device
CN105095280A (en) Caching method and apparatus for browser
CN104063460A (en) Method and device for loading webpage in browser
CN106339414A (en) Webpage rendering method and device
CN101122921A (en) Method forming tree-shaped display structure based on ajax and html
CN107807937B (en) Website SEO processing method, device and system
CN106897336A (en) Web page files sending method, webpage rendering intent and device, webpage rendering system
CN104317570B (en) The apparatus and method of dynamic analysis Web applications
CN113382083B (en) Webpage screenshot method and device
CN105095220B (en) A kind of browser implementation method, terminal and virtualization agent device
CN104731817B (en) A kind of webpage exhibiting method and device
CN103544271B (en) Load Image in a kind of browser the method and apparatus for processing window
CN107423342A (en) Page data querying method and device
CN106156298A (en) The method and device of the page is moved in a kind of website that generates
CN104519084A (en) Method and device for displaying messages

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