Embodiment
In order that those skilled in the art more fully understand the technical scheme in this specification one or more embodiment,
Below in conjunction with the accompanying drawing in this specification one or more embodiment, to the technology in this specification one or more embodiment
Scheme is clearly and completely described, it is clear that described embodiment is only part of the embodiment, rather than whole realities
Apply example.Based on this specification one or more embodiment, those of ordinary skill in the art are not making creative work premise
Lower obtained every other embodiment, it should all belong to the scope of disclosure protection.
All built-in Web page in many App, such as the client end AP P of many electric business platforms, are shown using Web page
Commodity.This Web page operated in APP is properly termed as the mobile Web page, and the mobile Web page can pass through mobile terminal
The loading displaying of WebView components.Wherein, a kind of resource can be included in the mobile Web page is page static resource, for example, with
CSS files in setting style sheet, js files for producing page interaction characteristic etc..
In a mobile Web page, the resource file of page static resource can include a variety of files, can have respectively
There is different filenames, such as, common.js is a js file, and creditManager.js is another js file,
Amui.css is a CSS file, and creditManager.css is another CSS file.The static resource that the page includes
The quantity of resource file and name can determine according to practical business demand, and the resource file of each page static resource can be with
With it in page presentation corresponding function.
The resource file of page static resource be able to may also update, such as, it is sometimes desirable to update the mobile Web page
Pattern and layout, or some trickle adjustment are done to the interaction characteristic of the page, then now just need to change changed page
Resource file corresponding to the characteristic of face.For example, it is assumed that some mobile Web page in a mobile terminal APP is to the pattern in the page
Upgraded, corresponding, the content in the CSS files that the page uses is updated, and with the addition of the generation of some novel types
Code.
Fig. 1 is referred to, Fig. 1 illustrates the more new construction of page static resource.The resource file of static resource can be deposited
Storage is in static resource server 11.One mobile Web page 13 of loading displaying, the exhibition of the mobile Web page 13 on mobile terminal 12
The resource file for showing one of static resource that needs load is a.css, for limiting style sheet.
Assuming that the version of the mobile Web page where the current mobile Web page 13 is version 1.0, in the page of version 1.0
During loaded and displayed, mobile terminal can call the resource file a.css stored in the resource address 1 of static resource server 11, and
And resource address 1 now can be https://a.b.c.com/manager/1.0/a/a.css, wherein, in resource address 1
1.0 be version number.
Assume that the page of the novel type of above-mentioned mobile Web page issue corresponds to version 2 .0 again, the page of the version 2 .0 pages
Face pattern has carried out pattern improvement relative to version 1.0, and the file content in corresponding a.css files is also modified, can be with
It is the increase in some new codes for adding pattern.Version 2 .0 a.css files can be stored in static resource server 11
In resource address 2, mobile terminal call resource file when be also that newest a.css files are obtained according to the resource address 2.But
Version 2 .0 a.css files are identical with the name of the a.css files of version 1.0.Resource address 2 can be https://
A.b.c.com/manager/2.0/a/a.css, wherein, 2.0 in resource address 2 be version number.
As above it can be seen that, the static resource in the mobile Web page can have multiple different resource address, above-mentioned row
The situation of act be due to FileVersion change cause resource address to change, actually implement in or other situations
Caused resource address change.But for mobile terminal, under the mechanism of above-mentioned version management, although resource address becomes
Change, but the resource called all is the different editions of same resource file, such as, all it is a.css, is this file
Address is changed, and the file content of this document is updated, one be version 1.0 a.css files, one is
Version 2 .0 a.css files;In other examples, it is also possible to which resource address is there occurs change but in resource file
Appearance does not update.
During the loading displaying of the mobile Web page, asked it sometimes appear that static resource server can not be provided normally
The static resource of calling is sought, so as to influence the normal use of business function.For example if a mobile Web page was loading
Cheng Zhong, the a.css of resource address 2 is called, the reason for being due to some unknown, static resource server can not be returned normally
The a.css, so as to cause Web page can not normal presentation, the business function of the page is also affected and is not normally functioning.One
As in the case of, when the static resource on invoking server can not be returned normally, user may can be appreciated that no pattern on the page
And the inoperable page, and when checking page resource state with developer's instrument, you can see 404 prompting, 404 i.e. generation
For table client when browsing webpage or obtaining resource, server can not normally provide information, or server can not be responded and not
Know reason.The 404 of invoking page static resource may influence page function normal use.
In order to solve 404 above-mentioned problems, ensure the business function normal operation of the page, Fig. 2 illustrates a kind of webpage exhibition
Show method, as shown in Fig. 2 this method can include:
In step 200, when rendering the page to be presented, according to Secondary resource address, obtained to Resource Server request
Take the page static resource of the second edition included in the page.
For example, it is assumed that to load a Web page in current mobile terminal APP, it is used to limit comprising some in the Web page
Style sheet and the static resource file of interaction.This step can take according to the resource address included in the page to static resource
Business device request call obtains the page static resource.
It is exemplary, by taking the a.css in Fig. 1 as an example, it is assumed that it is the version 2 .0 page corresponding to current Web page, root
According to resource address 2 to server acquisition request a.css.The resource address 2 can be referred to as Secondary resource address, i.e., currently
Address corresponding to the static resource of request, version 2 .0 a.css can be referred to as to the page static resource of the second edition.
In step 202, when Resource Server returns to resource acquisition failure, obtain and provided with the page of first version static state
First resource address corresponding to source, the first resource address are to determine the page static resource that can provide the first version
Address.
For example, due to certain unknown cause, static resource server returns 404, and the a.css of resource address 2 can not be obtained
Get.So, this step can obtain first resource address corresponding to the a.css of first version, and the first resource address is
What is had determined can stablize the address for providing page static resource a.css, i.e., can be protected substantially by the first resource address
Card can get a.css, and the a.css only got can be another version.For example the first resource address can be with
It is the resource address 1 in Fig. 1, or the unshowned resource address of other Fig. 1.Furthermore, it is necessary to illustrate, in this example
" second " or " first " being related to, it is intended merely to distinguish different resource address, or it is static in order to distinguish the same page
The different editions of resource, and do not have other restriction effects.
In step 204, according to first resource address, to the static money of the page of Resource Server acquisition request first version
Source.
In this step, mobile terminal can be according to first resource address, to Resource Server acquisition request page static resource.
For example when the resource address 1 in by Fig. 1 can not get a.css, a.css can be obtained according to resource address 1 again.
In step 206, receive and load the page static resource of the first version of the Resource Server feedback,
To render and show the page.
The address of the page static resource can be provided because first resource address is to determine, so mobile terminal now may be used
To receive for example above-mentioned a.css of static resource of static resource server return, and loaded and displayed, so as to normally show Web
The page.
The web page display method of this example, by when server returns to resource acquisition and failed, passing through first resource address
The resource is asked to server, ensure that the static resource that can get the page so that the business function of the page can be normal
Operation.Although according to first resource address, it is possible to the text the to be obtained when resource file for causing to return not is first request
Part, such as, the file of the two addresses has the difference on some style sheets, and still, the method for this example can be to greatest extent
Guarantee business function normal operation, sometimes page function normally will be more important relative to the renewal of style sheet.
The above-mentioned process that 404 situations are prevented by first resource address is described in detail with an example again as follows.Wherein,
The mobile Web page can load displaying by WebView components, and the WebView can regard loaded and displayed webpage as
Browser.The WebView can include Web Engine WebCore and WebViewClient, wherein, webcore can be located at
The module of the responsible analyzing web page of bottom (C/C++ layers), WebViewClient can be responsible the holding positioned at upper strata (Java layers)
The module of some call requests of row, when WebCore is needing to call some resources during parsing the page, can be notified
WebViewClient goes to obtain these resources.WebCore, WebViewClient and static resource server can be described below
Interaction, illustrate how loading one mobile Web page of displaying come business function failure caused by overcoming 404.It is divided into resource just
Often obtain when normal call flow and occur 404 when resource acquisition protection flow.
Normal call flow when the resource that Fig. 3 illustrates an example normally obtains, can include:
In step 300, WebCore notifies request static resource to WebViewClient, and it is quiet to carry the asked page
The resource identification of state resource.
In this step, WebCore is when parsing Web page, can be with when needing the static resource in the acquisition request page
Notice WebViewClient is gone to obtain the resource, and resource address is notified to WebViewClient.
In one example, WebCore can increase the resource identification of the static resource of the request in resource address, can
To be referred to as resourcekey.For example, it is assumed that resource address is https://a.b.c.com/manager/1.0/a/a.css, increase
After adding resourcekey, the address can be https://a.b.c.com/manager/1.0/a/a.cssresourcekey
=a.In this example embodiment, can be using a in the filename a.css of resource file as resourcekey, because different resources
File typically has different filenames, and the differentiation to different files can be realized using file name as resourcekey,
Realize the unique mark to each resource file of request.It is of course also possible to resource identification is set in other ways.
In step 302, WebViewClient provides according to resource address to the Resource Server acquisition request page is static
Source.
For example, WebViewClient can be according to address above mentioned https://a.b.c.com/manager/1.0/a/
a.cssResourcekey=a, remove the resource file a.css of static resource server request static resource.
In step 304, Resource Server normally returns to static resource to WebViewClient.
In this example, Resource Server can successfully return to the page static resource, and WebViewClient accordingly
It can also determine, the page static state can stably be provided by asking the resource address of resource institute foundation to be to determine in step 302
The address of resource.
Within step 306, WebViewClient returns to static resource to WebCore.
WebCore can receive the resource file of static resource, and load this document, normally to show the page.
In step 308, WebViewClient obtains the resource identification of static resource.
Because in step 304, WebViewClient has determined that the resource address of request resource institute foundation is to determine energy
Enough stable addresses for providing the page static resource, in this step, WebViewClient can obtain the money of the static resource
Source identifies.For example, can be by obtaining resource identification in resource address, address https://a.b.c.com/manager/1.0/
a/a.cssResource identification resourcekey=a can be obtained in resourcekey=a.
In the step 310, WebViewClient stores the corresponding relation of resource identification and resource address to local slow
Deposit.
For example, the corresponding relation of WebViewClient storages can be:
a——https://a.b.c.com/manager/1.0/a/a.cssResourcekey=a
Above-mentioned corresponding relation shows, is a page static resource for resourcekey, can stablize and provide the resource
One of resource address be https://a.b.c.com/manager/1.0/a/a.cssResourcekey=a.
Flow shown in above-mentioned Fig. 3, can be by resource and its stable money in the case where server normally returns to resource
The corresponding relation of source address is stored in local cache, in case the flow of subsequent figure 4 uses.Wherein, when mobile terminal repeatedly parses page
During face, for example user repeatedly opens APP, to show the page, may repeatedly ask the page static resource of the page, still
Local cache can store a corresponding relation.
Fig. 4 illustrates the protection flow occurred when request static resource returns to 404 error code of an example, the Fig. 4's
Flow can use the corresponding relation to Fig. 3 storages, wherein, can be by the corresponding relation of storage in the example shown in Fig. 3
Resource address https://a.b.c.com/manager/1.0/a/a.cssResourcekey=a is with being referred to as first resource
Location, the resource normally returned can be referred to as to the page static resource of first version.As shown in figure 4, the method for this example can be with
Including:
In step 400, WebCore notifies request static resource to WebViewClient, and it is quiet to carry the asked page
The resource identification of state resource.
In this step, WebCore is when parsing Web page, can be with when needing the static resource in the acquisition request page
Notice WebViewClient is gone to obtain the resource, and resource address is notified to WebViewClient.Resource in the step
Address is properly termed as Secondary resource address, for example, the Secondary resource address can be https://a.b.c.com/manager/
2.0/a/a.cssResourcekey=a, i.e., the Secondary resource address is address corresponding to the Web page of 2.0 versions, and preceding
The first resource address in face is 1.0 versions.
In step 402, WebViewClient is according to Secondary resource address, to the Resource Server acquisition request second edition
This page static resource.
For example, WebViewClient can be according to address above mentioned https://a.b.c.com/manager/2.0/a/
a.cssResourcekey=a, remove the resource file a.css of static resource server request static resource.Only this
A.css is that the a.css obtained in the a.css of the second edition, with Fig. 3 examples can not be same version, such as specific sample
Formula has carried out some changes.
In step 404, Resource Server returns to 404 to WebViewClient.
In this example, Resource Server may not find the page static resource.
In a step 406, WebViewClient in Secondary resource address by obtaining resource identification.
For example, can be by https://a.b.c.com/manager/2.0/a/a.cssIn resourcekey=a, obtain
Get resource identification resourcekey=a.
In a step 408, WebViewClient is according to resource identification, the first resource as corresponding to obtaining local cache
Location.
In this step, because the page static resource of the second edition and the page static resource of first version correspond to same money
Source identifies, such as, resourcekey is a, and WebViewClient can be corresponding to local cache acquisition request
Resourcekey first resource address.
In step 410, WebViewClient receives the first resource address that local cache returns.
For example, the first resource address can be the ground in the corresponding relation stored in Fig. 3 flows, https://
a.b.c.com/manager/1.0/a/a.cssResourcekey=a.It can be the address of 1.0 versions.
In step 412, WebViewClient is according to first resource address, to page described in Resource Server acquisition request
Face static resource.
In step 414, WebViewClient receives the resource file of server return.
The address that resource is provided can be stablized because first resource address is to determine, so WebViewClient is in basis
During first resource Address requests resource, the resource file can be got.Such as when (the second money of resource address 2 in Fig. 1
Source address) obtain less than resource file when, resource file can be got in resource address 1 (first resource address) because should
Address had normally returned to the address of resource before being.
In step 416, resource file is returned to WebCore by WebViewClient.
In this step, resource file is returned to WebCore by WebViewClient, and such WebCore can load static state
Resource, page function can be with normal operations.
In addition, WebViewClient, which may call upon daily record, reports interface, warning message is reported, to notify developer
Check the problem of Secondary resource address acquisition is less than resource file.
The web page display method of this example, by when server returns to resource acquisition and failed, passing through first resource address
The resource is asked to server, ensure that the static resource that can get the page so that the business function of the page can be normal
Operation.
In order to realize above-mentioned method, this specification one or more embodiment additionally provides a kind of web page display device,
As shown in figure 5, the device can include:Resource request module 51, address acquisition module 52, re-request module 53 and resource connect
Receive module 54.
Resource request module 51, for when rendering the page to be presented, according to Secondary resource address, to Resource Server
The page static resource of the second edition included in the page described in acquisition request;
Address acquisition module 52, for when the Resource Server return resource acquisition failure when, obtain and first version
The page static resource corresponding to first resource address, the first resource address is determined to provide the first version
Page static resource;
Re-request module 53, for according to the first resource address, to described in the Resource Server acquisition request
The page static resource of first version;
Resource receiving module 54, the static money of the page of the first version for receiving and loading the Resource Server feedback
Source, to render and show the page.
In one example, as shown in fig. 6, the device also includes address memory module 55.
Resource request module 51, be additionally operable to according to Secondary resource address to the Resource Server acquisition request second edition
It is static to the page of Resource Server acquisition request first version according to first resource address before page static resource
Resource;
Address memory module 55, for when the Resource Server successfully returns to the page static resource, it is determined that
The first resource address is to determine the address for the page static resource for providing first version, stores the static money of the page
The resource identification in source and the corresponding relation of the first resource address.
In one example, resource request module 51, it is additionally operable to as resource mark corresponding to the page static resource allocation
Know, and the resource identification is arranged in the first resource address;
The address memory module 55, specifically for by obtaining the resource identification in the first resource address, storing
The corresponding relation of resource identification and the first resource address.
In one example, address memory module 55, specifically for by the resource identification of the page static resource and
The corresponding relation of one resource address, is stored in local cache.
In one example, address acquisition module 52, for by obtaining the resource identification in the Secondary resource address,
The resource identification of the page static resource is carried in the Secondary resource address;And according to the resource identification, acquisition and institute
State the first resource address corresponding to resource identification;The page static resource of the second edition and the page of first version
Face static resource corresponds to the same resource identification.
For convenience of description, it is divided into various modules during description apparatus above with function to describe respectively.Certainly, this is being implemented
The function of each module can be realized in same or multiple softwares and/or hardware during specification one or more embodiment.
Each step in flow shown in above method embodiment, its execution sequence are not restricted to the order in flow chart.
In addition, the description of each step, it is possible to achieve be software, hardware or its form combined, for example, those skilled in the art can
Can be that the computer that can realize logic function corresponding to the step can perform in the form of implementing these as software code
Instruction.When it is realized in a manner of software, described executable instruction can store in memory, and by the place in equipment
Device is managed to perform.
For example, corresponding to above-mentioned web page display method, this specification one or more embodiment provides a kind of webpage simultaneously
Presentation device, the meter that the equipment can include processor, memory and storage on a memory and can run on a processor
Calculation machine instructs, and the processor is by performing the instruction, for realizing following steps:When rendering the page to be presented, root
According to Secondary resource address, to the page static resource of the Resource Server acquisition request second edition;When the Resource Server returns
When returning resource acquisition failure, acquisition first resource address corresponding with the page static resource of first version, described first
Resource address is to determine the address for the page static resource for providing the first version;According to the first resource address, Xiang Zi
The page static resource of source server acquisition request first version;Receive and load the described of the Resource Server feedback
The page static resource of first version, to render and show the page.
The device or module that above-described embodiment illustrates, can specifically be realized by computer chip or entity, or by with
The product of certain function is realized.One kind typically realizes that equipment is computer, and the concrete form of computer can be personal meter
Calculation machine, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media player, navigation are set
It is any several in standby, E-mail receiver/send equipment, game console, tablet PC, wearable device or these equipment
The combination of equipment.
It should be understood by those skilled in the art that, this specification one or more embodiment can be provided as method, system or
Computer program product.Therefore, this specification one or more embodiment can use complete hardware embodiment, complete software to implement
The form of embodiment in terms of example or combination software and hardware.Moreover, this specification one or more embodiment can be used one
Individual or multiple computer-usable storage mediums for wherein including computer usable program code (include but is not limited to disk storage
Device, CD-ROM, optical memory etc.) on the form of computer program product implemented.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to
Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or
The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or
The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in individual square frame or multiple square frames.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to nonexcludability
Comprising so that process, method, commodity or equipment including a series of elements not only include those key elements, but also wrapping
Include the other element being not expressly set out, or also include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described
Other identical element also be present in the process of element, method, commodity or equipment.
This specification one or more embodiment can computer executable instructions it is general on
Described in hereafter, such as program module.Usually, program module includes performing particular task or realizes particular abstract data type
Routine, program, object, component, data structure etc..Can also put into practice in a distributed computing environment this specification one or
Multiple embodiments, in these DCEs, by being performed by communication network and connected remote processing devices
Task.In a distributed computing environment, the local and remote computer that program module can be located at including storage device is deposited
In storage media.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment
Divide mutually referring to what each embodiment stressed is the difference with other embodiment.Especially for service end
For apparatus embodiments, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to method
The part explanation of embodiment.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the action recorded in detail in the claims or step can be come according to different from the order in embodiment
Perform and still can realize desired result.In addition, the process described in the accompanying drawings not necessarily require show it is specific suitable
Sequence or consecutive order could realize desired result.In some embodiments, multitasking and parallel processing be also can
With or be probably favourable.
The preferred embodiment of this specification one or more embodiment is the foregoing is only, not limiting this public affairs
Open, it is all within the spirit and principle of the disclosure, any modification, equivalent substitution and improvements done etc., it should be included in the disclosure
Within the scope of protection.