Summary of the invention
To defective that exists in the prior art and deficiency; The objective of the invention is to propose a kind ofly to guarantee that client swims the method for successful browsing page; Can be when dns server to be resolved the domain name mistake of the built-in network address in the client, client still can successfully be browsed and want the webpage browsed.
In order to achieve the above object, the present invention proposes a kind of method of guaranteeing client success browsing page, comprising:
Step 1: in having the client of built-in network address, preset a plurality of domain names, wherein, the pairing webpage of new network address that said a plurality of domain names are replaced after the domain name in the said built-in network address has identical content with the pairing webpage of said built-in network address;
Step 2: when using said built-in network address visit failure, from said a plurality of domain names, randomly draw the domain name that a domain name replaces in the said built-in network address and obtain new network address, if use said network address visit successfully, then end; If failure, then execution in step 3;
Step 3: the domain name that another domain name of extraction is replaced in the said network address from said a plurality of domain names obtains new network address, if use said network address to visit successfully, then finishes; If failure then continues execution in step 3;
Preferred as technique scheme also comprises after from said a plurality of domain names, extracting a domain name: judge the domain name that extracted whether with said built-in network address in domain name identical, if identical, then execution in step 3.
Preferred as technique scheme, from said a plurality of domain names, randomly draw a domain name in the said step 2 after, also be included as said a plurality of domain name the index value that continuous integral number is represented be set, the index value of the wherein said domain name of randomly drawing is minimum.
Preferred as technique scheme, said step 3 specifically comprises:
Step 31: from said a plurality of domain names, extract the index value that was last time extracted domain name and add the index value domain name pointed after 1,, then carry out step 32,, then finish if said index value surpasses maximum index value if said index value does not surpass maximum index value;
Step 32: the domain name of replacing in the said network address with the domain name of said index value sensing obtains new network address, if use said network address visit failure, then returns execution in step 31.
Preferred as technique scheme, when said index value surpassed maximum index value, the failure of client browsing page was with said index value zero clearing.
Preferred as technique scheme also comprises after the said step 31: judge the domain name that extracted whether with said built-in network address in domain name identical, if identical, then return execution in step 31.
The present invention also proposes a kind of client, comprises at least:
Access modules is used for according to the network address accessed web page;
Preset the domain name module, be used for presetting a plurality of domain names in client with built-in network address; Wherein, the pairing webpage of new network address replaced after the domain name in the said built-in network address of said a plurality of domain name has identical content with the pairing webpage of said built-in network address;
First extracts and the replacement module; Being used for said access modules uses said built-in network address to visit when failing; From said a plurality of domain names, randomly draw the domain name that a domain name replaces in the said built-in network address and obtain new network address; Make said access modules use said network address accessed web page, if success then finishes;
Second extracts and the replacement module; Being used for said access modules uses said first to extract and during the replacement module obtains said network address visit failure; The domain name that another domain name of extraction is replaced in the said network address from said a plurality of domain names obtains new network address; Make said access modules use said network address accessed web page, if success then finishes; If failure, then said second abstraction module continues operation.
Preferred as technique scheme; Also comprise judge module; Be used for said first extract and replacement module and second extracts and the replacement module after said a plurality of domain names extract a domain name, judge the domain name that extracted whether with said built-in network address domain name identical; If identical, then make said second to extract and replacement module extraction domain name.
Preferred as technique scheme, said first extract and the replacement module in comprise:
Indexing units, after being used for randomly drawing a domain name from said a plurality of domain names, for said a plurality of domain names are provided with the index value that continuous integral number is represented, the index value of the domain name of wherein randomly drawing is minimum.
Preferred as technique scheme, said second extracts and the replacement module specifically comprises:
Second extracting unit is used for extracting the index value that is last time extracted domain name from said a plurality of domain names and adds the index value domain name pointed after 1, when said index value surpasses maximum index value, finishes;
The second replacement unit, the domain name that is used for the domain name that said second extracting unit extracts is replaced said network address obtains new network address, if said access modules is used said network address accessed web page success, then finishes; If failure then continues said second extracting unit of operation.
The method and apparatus of guaranteeing client success browsing page that the present invention proposes; Through in client, presetting a plurality of interchangeable domain names; Guarantee when dns server can't correctly be resolved the domain name of the built-in network address of client; Can be automatically another have the webpage of identical content with its replacement back visit, therefore, increased the chance of success that client is browsed the webpage of originally wanting to browse greatly.
Below in conjunction with accompanying drawing, specific embodiments of the invention is described in further detail.For the person of ordinary skill in the field, from detailed description of the invention, above-mentioned and other purposes of the present invention, feature and advantage will be obvious.
Embodiment
As shown in Figure 1, guarantee that client success browsing page method comprises:
Step 1: in having the client of built-in network address, preset a plurality of domain names, wherein, the webpage that said a plurality of domain names are replaced the network address after the domain name in the said built-in network address has identical content with the webpage of said built-in network address; Here, the quantity of built-in domain name can be a plurality of for arbitrarily, and for example 10,20, but too much unsuitable, avoid taking too much mobile phone EMS memory;
Step 2: when using said built-in network address visit failure, from said a plurality of domain names, randomly draw the domain name that a domain name replaces in the said built-in network address and obtain new network address, if use said network address visit successfully, then end; If failure, then execution in step 3;
Step 3: the domain name that another domain name of extraction is replaced in the said network address from said a plurality of domain names obtains new network address, if use said network address to visit successfully, then finishes; If failure then continues execution in step 3;
When client during based on the network address accessed web page, corresponding server can return an access code, the different different implications of access code representative.Through judging whether access code is that the visit failure judges whether access server fails, and the example of access code is following:
200-299 representative visit is normal; 300-399 represents redirect; 400-504 representative visit failure, wherein, 400: false request; 403: forbid; 404: do not find; 408: request timed out; 410: expired; 500: internal server error; 502: the gateway mistake; 503: disabled service; 504: gateway is overtime.
After adopting the present technique scheme; When dns server can't correctly be resolved in the client domain name in the built-in network address; Another has the webpage of identical content can be automatically the domain name that presets to be substituted the back visit with it, has increased the chance of success that client is browsed the webpage of wanting to browse greatly.
In the above-described embodiments; In order further to improve the efficient of replacement domain name and successful access webpage; In said step 2 and the said step 3 from said a plurality of domain names, extract a domain name after also comprise: judge the domain name that extracted whether with said built-in network address in domain name identical; If identical, then execution in step 3.Because if the replacement be with built-in network address in the identical domain name of domain name; Owing to use the built-in network address can not the successful access webpage, so, use the network address after the replacement domain name certainly can not successful access; So, can judge in advance the domain name that will replace whether with built-in network address in domain name identical.
And, can also a plurality of domain names that preset in the foregoing description be carried out index number, also be in order to improve the efficient of domain name replacement, and guarantee that all domain names all and are only participated in once replacement in case of necessity.Can also comprise in the said step 2:
After from said a plurality of domain names, randomly drawing a domain name, for said a plurality of domain names are provided with the index value that continuous integral number is represented, the index value of the wherein said domain name of randomly drawing is set to minimum.
For example; Before each domain names of a plurality of domain names that preset, add numbering for example 1 successively; 2;, 10 are used for indicating different domain names and the pairing index value of this domain name randomly drawed in the step 2 is made as the index value of minimum (for example being the minimum value 1 in the above-mentioned numbering), to guarantee that index value in case of necessity presets domain name greater than it other and also can both be extracted successively.Index value is when presetting domain name, is the numbering of each domain name interpolation.
Said step 3 can be specially:
Step 31: from said a plurality of domain names, extract the index value that last time was extracted domain name and add the index value domain name pointed after 1; If said index value does not surpass maximum index value (maximum index value for example is the maximum 10 in the above-mentioned numbering); Then execution in step 32; If said index value, illustrates all domain names that preset above maximum index value and had all carried out replacement, then finishes this method;
Here, the difference of maximum index value and minimum index value adds the quantity of 1 a plurality of domain names of equaling to preset, that is to say, what have preset domain name, just can repeatedly not extract how many times at most.
Step 32: the domain name of replacing in the said network address with domain name obtains new network address, if use said network address to visit successfully, then finishes; If execution in step 31 is then returned in failure.
Like this, when just having guaranteed the domain name of built-in network address in the replacement client, all domain names that preset can both repeatedly not go to replace.
When said index value surpasses maximum index value, explain and uses all domain names that preset that client is browsed to want the webpage of browsing that therefore, the failure of client browsing page at this moment should be with the index value zero clearing, prepares against to reuse later on.
Can also comprise after the said step 31 of the foregoing description: judge the domain name extracted whether with said built-in network address in domain name identical, if identical, then return execution in step 31.
Please continue to consult Fig. 2, Fig. 2 is the structural representation of a kind of client of the present invention's proposition.As shown in Figure 2, a kind of client comprises:
Access modules 201 is used for according to the network address accessed web page;
Preset domain name module 202, be used for presetting a plurality of domain names in client with built-in network address; Wherein, the pairing webpage of new network address replaced after the domain name in the said built-in network address of said a plurality of domain name has identical content with the pairing webpage of said built-in network address;
First extracts and replacement module 203; When being used for access modules 201 and using built-in network address visit failure, from said a plurality of domain names, randomly draw the domain name that a domain name replaces in the said built-in network address and obtain new network address, make access modules 201 use said network address accessed web page; If success then finishes;
Second extracts and replacement module 204; Being used for the access modules 201 said network address that use first is extracted and replacement module 203 obtains visits when failing; The domain name that another domain name of extraction is replaced in the said network address from said a plurality of domain names obtains new network address; Make access modules 201 use said network address accessed web page, if success then finishes; If failure, then second abstraction module 204 continues operation.
Wherein, This client can also comprise judge module; Be used for said first extract and replacement module and second extracts and the replacement module after said a plurality of domain names extract a domain name, judge the domain name that extracted whether with said built-in network address domain name identical; If identical, then make said second to extract and replacement module extraction domain name.So just can improve replacement efficient; Because if the replacement be with built-in network address in the identical domain name of domain name; Owing to use the built-in network address can not the successful access webpage, so, use the network address after the replacement domain name certainly can not successful access; So, can judge in advance the domain name that will replace whether with built-in network address in domain name identical.
Wherein, first extract and replace in the module 203 and can also comprise:
Indexing units, after being used for randomly drawing a domain name from said a plurality of domain names, for said a plurality of domain names are provided with the index value that continuous integral number is represented, the index value of the domain name of wherein randomly drawing is minimum.
Second extracts and replace module 204 specifically comprises:
Second extracting unit is used for extracting the index value that is last time extracted domain name from said a plurality of domain names and adds the index value domain name pointed after 1, when said index value surpasses maximum index value, finishes;
The second replacement unit, the domain name that is used for the domain name that said second extracting unit extracts is replaced said network address obtains new network address, if said access modules is used said network address accessed web page success, then finishes; If failure then continues said second extracting unit of operation.
Second extract and replacement module 204 in can also comprise judging unit, be used for judging whether the domain name that said second extracting unit extracted identical with the domain name of said built-in network address, if identical, then said second extracting unit continues to extract domain name again.
Can also comprise dump block in this client, be used for when said index value surpasses maximum index value that the failure of client browsing page is with said index value zero clearing.
This client for example can be installed in the portable terminals such as mobile phone, PDA, notebook, also can be exactly portable terminals itself such as mobile phone, PDA, notebook.
Though; The present invention clearly demonstrates through above embodiment and accompanying drawing thereof; Yet under the situation that does not deviate from spirit of the present invention and essence thereof; The person of ordinary skill in the field works as can make various corresponding variations and correction according to the present invention, but these corresponding variations and correction all should belong to the protection range of claim of the present invention.