Specific embodiment
Here will the description is performed on the exemplary embodiment in detail, the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistent with the application.On the contrary, they be only with it is such as appended
The example of the consistent device and method of some aspects be described in detail in claims, the application.
Several nouns involved in the embodiment of the present application are explained first:
Webpage load: the load corresponding resource file of webpage and data cached process.Wherein, resource file is webpage note
Necessary composing document when load, the html file including webpage, CSS file, JS file etc., these resource files are for webpage
The information such as the frame infrastructure elements of display, including layout structure configuration, functional module configuration, system configuration, only to webpage
The Shi Caihui that modifies is related to modification and update to these resource files.Data cached is the number for needing to be loaded on webpage
According to referring generally to the corresponding informations such as picture, text, video.Therefore, during carrying out webpage load, by data cached and money
Source file combines to form complete webpage.
Mixed mode mobile application (Hybrid App): refer between network application (Web App) and locally applied
Mobile application between (Native App) the two has both " advantage of locally applied good user-interaction experience " and " network
The advantage of application cross-platform exploitation ".The installation of mixed mode mobile application needs to install from application shop, but update can be with for part
Do not upgraded by application shop.
Network application: it is a kind of application software operated on the net using web browser in internet or enterprises, is
The application program that one kind is write with homepages language (such as the programming languages such as HTML, JavaScript, Java), needs to pass through browsing
Device is run.Network application can directly be run on computer platform, not need to realize installation or regular upgrade procedure.
It is locally applied: also known as ecosystem application, be it is a kind of based on smart phone native operating sys-tern such as ios system,
Android system, WP system, and write using native program the third party application of operation, generally using Java, C++,
The programming languages such as Objective-C carry out application and development.
JS file: JS is the abbreviation of JavaScript language, and JS file is that high-level language JavaScript is used in webpage
Formatted file.
Network view (Web View): being a kind of browser kernel container, built-in browser core engine, as Web Kit,
Web Core etc., support are loaded directly into and show webpage, the also dynamic function of the webpages such as support forward-reverse, browsing history.Net
The function of network view load webpage and the dynamic function of added support grid page are real by the JavaScript code in JS file
Existing.
Fig. 1 is a kind of schematic diagram of implementation environment shown according to an exemplary embodiment.As shown in Figure 1, of the invention
Implementation environment includes: terminal 100 and server 200.
Wherein, terminal 100 is for installing and running mixed mode mobile application, by using provided by mobile application
Family interactive interface realizes the interaction between user.Terminal 100 can be smart phone, tablet computer or any other
The client device of mixed mode mobile application can be run, this place is without limiting.
Server 200 is for storing mass data, in the normal operation of mobile application, response mobile application is initiated
Service request, and according to service request carry out data processing, provide reliable service for the operation of mobile application.Server
200 can be a server, or the server cluster being made of several servers, this place is also without limiting.
Fig. 2 is a kind of application system frame signal of the mixed mode mobile application proposed according to an exemplary embodiment
Scheme, the native operating sys-tern of smart phone corresponding to the mobile application is Android system.
Wherein, network view is the key foundation of entire application system, mainly as browser kernel container for realizing
The load of page end webpage, and support is provided to the subsequent operation after the completion of webpage load, such as: on file download, file
Biography, data buffer storage etc..
Webpage loading interface includes some specific methods, these methods are used to carry out network view the process of webpage load
It is tracked, for example, by the percentage of tracking webpage load progress, to know that webpage starts load, webpage load error, net
Situations such as page load is completed.
JS interface includes for providing the JS function at the local side invoking web page end (function realized using JavaScript code
Can) specific method, correspondingly, android interface include for provide page end call local side system function it is specific
Method.Mixed mode mobile application will realize the interaction between local side and page end as a result, need to carry out JS interface in frame
Mutual calling between android interface.
Android interface is also used to call directly the system function integrated in frame, and upgrade function as shown in Figure 2 disappears
Prompt facility, system tool class function etc. are ceased, or passes through android interface customized system function (example in application system
It such as exits, the corresponding function of return key).
Local side can then obtain the system function integrated in frame by invocation framenort interface, for example, by calling such as
Upgrade interface shown in Fig. 2, to obtain the upgrade function integrated in frame.
It should be noted that the application system frame of mixed mode mobile application shown in Fig. 2 only adapts to the present invention
An example, must not believe that there is provided any limitations to use scope of the invention.The mixed mode mobile application
Application system frame can not be construed to need to rely on or must have one or more component shown in Fig. 2.
Fig. 3 is a kind of flow chart of the abnormality monitoring method of webpage load shown according to an exemplary embodiment.Such as Fig. 3
Shown, this method at least includes the following steps:
Step 110, during mixed mode mobile application loads webpage by network view, monitoring system console
The message logging printed.
Wherein, system control position is mixed mode mobile application control terminal application program set in application system,
Various functions, such as call function, multimedia function, browser function etc. for controlling and coordinating application system.
When system control position monitors that application system occurs abnormal in the process of running, system control position can be printed accordingly
Message logging, therefore, the message logging that system control position is printed should include application system in entire message log.
And mixed mode mobile application by network view load webpage during, for timely learning network view
Whether there is exception to the load of current web page, the message logging for needing monitoring system console to be printed, especially with browser
The corresponding message logging of kernel.
It should be noted that system control position runs occurred abnormal monitoring to application system, and according to being supervised
The function of the abnormal printmessage log measured is provided by mobile device native operating sys-tern (such as Android system)
Primary function, this place do not repeat them here.
Also, since HTML5 (abbreviation H5) webpage supports more interactive functions, and can be in mobile device (such as intelligence
Mobile phone) on support multimedia function, in the present embodiment, support grid page added by network view specifically can be H5 webpage.
In one embodiment, as shown in figure 4, the message logging that monitoring system console is printed can specifically include with
Lower step:
Step 111, according to set monitoring thread, the Application Programming Interface of system control position is monitored.
Wherein, the Application Programming Interface (API, Application Programming Interface) of system control position
Specially function predetermined in control terminal application program is able to access system control position for providing other applications
Ability.
System control position includes different application programming interface, respectively with system control position in application system
The monitoring that different application is carried out corresponds, wherein the different application in application system is respectively used to answer at this
With realizing different functions in system.
For example, network view during loading webpage, can be the monitoring that webpage load whether there is exception logical
It crosses JavaScript Application Programming Interface provided by page end to realize, wherein JavaScript Application Programming Interface is specific
It may include multiple interfaces corresponding with the operating condition of application program.
As an example it is assumed that in the JavaScript application program of page end, it is primary in Android system when calling
(Console) when object, the Web Kit engine of Android system supports JavaScript Application Programming Interface below, then may be used
It is monitored by the set following Application Programming Interface of monitoring thread:
“console.log(String)
console.info(String)
console.warn(String)
console.error(String)”。
Step 113, it reports an error if monitoring the application programming interface, disappears to monitor system control position and having printed
Cease log.
Wherein, application programming interface reports an error, and indicates that system control position monitors in application system to realize difference
There is exception in operation in the application program of function, and system control position then prints message day corresponding with the exception occurred
Will.
As a result, if the application programming interface that monitoring thread monitors system control position reports an error, it is considered as and monitors
System control position has printed message logging.
In a preferred embodiment, the method for realizing the message logging that monitoring system console is printed, it is above-mentioned executing
Before step 111 can with the following steps are included:
The application programming interface list that detection configuration center is loaded is with the presence or absence of update;
If it is present the application programming interface list updated is obtained, according to application programming interface list institute
System control position is monitored comprising application programming interface.
Wherein, configuration center is the application program operated on server corresponding to mixed mode mobile application, is used for root
The various application programs in application system are configured according to the configuration data for being included.
In the present embodiment, configuration center is loaded with application programming interface list, and system control position need to be according to the name
Application programming interface included in list, to be monitored to the operating condition of application program each in application system.
Since in the application programming interface list that configuration center loads, the application programming interface for being included can
Dynamic configuration is carried out, therefore, before executing step 111, also needs to detect the application programming interface that configuration center is loaded
List is with the presence or absence of update.
If detecting that the list exists to update, the list is obtained, and compile according to application program included in list
Journey interface is monitored system control position, that is, the application programming interface of institute's monitoring system console, should in configuration
The application programming interface that the loaded application programming interface list of the heart is included corresponds.
It should be noted that it includes being included to the list that application programming interface list, which has more news,
Application programming interface has carried out the operation for increasing, deleting or replacing.
For example, due to application program generally only respective code run there is wrong (error) in the case where,
It may cause code to be not normally functioning, therefore, be supported in the Web Kit engine of Android system as previously described
In JavaScript Application Programming Interface, only " console.error (String) " interface can be monitored.
It as a result, can be by carrying out dynamic configuration to the loaded application programming interface list of configuration center, with realization pair
The application programming interface specified in system control position is monitored, and flexibility and scalability is more preferably.Also, it can also pass through
Method provided in this embodiment is filtered function unnecessary in application system, to save system resource.
Step 130, it when monitoring system control position and having printed unexpected message log corresponding with browser kernel, obtains
Unexpected message log is taken, and the rank that webpage is abnormal is loaded according to unexpected message log acquisition browser kernel.
Wherein, due to needing to call browser kernel when network view loads webpage, it needs to monitor in the present embodiment
Whether system control position has printed unexpected message log corresponding with browser kernel.The exception that system control position is printed disappears
It ceases in log, runs the code content for exception occur, lines of code corresponding to abnormality code, different including corresponding application programs
Abnormal rank corresponding to normal code etc..Abnormal rank corresponding to abnormality code is also referred to as the type letter of unexpected message log
Breath, it may include the different stages such as info, debug, trace, warn, error.
As previously mentioned, monitoring system control position has printed unexpected message log corresponding with browser kernel, refer to
System control position application programming interface corresponding with browser kernel is monitored to report an error.If monitoring system control position
Have printed the unexpected message log, then it represents that network view abnormal feelings occurs during loading current web page, needs basis
Unexpected message log judgement leads to the reason of network view load webpage exception.
Since the function of network view load webpage is that the JavaScript code write by developer is realized,
The unexpected message log printed therefore, it is necessary to obtain system control position, by being solved to acquired unexpected message log
Analysis, to obtain whether the reason for causing webpage load abnormal is JavaScript code mistake set in application system.
In one embodiment, the method for obtaining the printed unexpected message log of system control position at least may include following step
It is rapid:
When monitoring system control position and having printed unexpected message log corresponding with browser kernel, pass through called side
Method exports unexpected message log to same command line tool;
Unexpected message log is obtained from same command line tool.
Wherein, when monitoring thread, which monitors system control position, has printed unexpected message log, application system passes through readjustment
Method exports the unexpected message log that system control position is printed into the command-line tool of application system (Logcat).
Command-line tool be then provided by the log system of native operating sys-tern one for collecting and check system day
Then the debugging output mechanism of will will be received by collecting a series of message loggings from the various application programs of application system
The message logging of collection is put into command-line tool, and the corresponding order of command-line tool may be used and check and filter these message days
Will.
Specifically, when calling primary (Console) object, can lead in the JavaScript application program of page end
Calling " onConsoleMessage () " method is crossed, the unexpected message log for printing system control position is exported to order line work
In tool, then, then by calling " setWebChormeClient (method) " of network view that unexpected message log is passed to
Network view.
At the same time it can also pass through " messageLevel () " method for calling network view, to obtain unexpected message log
Abnormal rank, thus may make network view during carrying out load webpage, can timely learning current web page load
Abnormal information.
Step 150, if unexpected message log indicates that exception occurred is error level, in the webpage loaded
It is loaded into abnormal prompt information.
Wherein, unexpected message log indicates that exception occurred refers to for error level, passes through side described in step 130
Method, obtaining the abnormal rank that unexpected message log is recorded is error rank.Abnormal prompt information can specifically include abnormal letter
Cease prompting frame and/or the exception error page.
In one embodiment, if unexpected message log is error level, network view is controlled currently-loaded
Webpage in pop up exception information prompting frame, to prevent white screen occur in added support grid page, increase user experience.
The situation that exception information prompting frame is used to prompt the load of user's current web page abnormal, at this point, user can choose pass
Close current web page, or exit mixed mode mobile application, so that user be avoided to continue business operation, and cause it is unnecessary
Traffic issues.
And in another embodiment, after popping up exception information prompting frame in currently-loaded webpage, if detection
It is triggered to the exception information prompting frame, then controls network view for currently-loaded webpage and jump to the exception error page.
Wherein, trigger action corresponding to exception information prompting frame can be user's click or long-pressing user interface
In, region corresponding to the exception information prompting frame, or when can also be that the display of the exception information prompting frame reaches specified
Between length when, the application program as set by application system actively triggering.Or it can also be using other triggering modes, this place
Without any restriction.
It should be noted that the exception error page described in the present embodiment specifically can be H5 webpage, further to hinder
Only user continues business operation in the case where webpage exception.
And in another more preferably embodiment, the exception error page be specially one via special designing webpage, such as
It is a webpage trivial games, or user's picture of good visual effect can be brought, further promotes user and the movement is answered
Experience sense.
Therefore, compared with prior art, method provided herein can be avoided webpage and white screen occurs, effectively be promoted
User experience, while in the case where webpage loads exception, it can be avoided the business that user continues operation and causes
Problem.
Fig. 5 is a kind of block diagram of the exception monitoring apparatus of webpage load according to shown by an exemplary embodiment.Such as Fig. 5
Shown, which includes message logging monitoring module 210, target information acquisition module 230 and webpage abnormal prompt module 250.
Message logging monitoring module 210 is used to carry out the mistake of webpage load by network view in mixed mode mobile application
Cheng Zhong, the message logging that monitoring system console is printed;
Target information obtain module 230 be used for monitor the system control position have printed it is corresponding with browser kernel
Unexpected message log when, obtain the unexpected message log, and in the browser according to the unexpected message log acquisition
The rank that core load webpage is abnormal;
Webpage abnormal prompt module 250 is used to indicate that exception occurred is error level in the unexpected message log
In the case of, abnormal prompt information is loaded into the webpage loaded.
In a further exemplary embodiment, message logging monitoring module 210 specifically includes thread monitor unit and information is known
Other unit.
Wherein, thread monitor unit is used for according to set monitoring thread, to the application program of the system control position
Programming interface is monitored.
Information identificating unit is used to then be identified as monitoring in the case where monitoring the application programming interface and reporting an error
Message logging is had printed to the system control position.
In a further exemplary embodiment, message logging monitoring module 210 further includes updating information detecting unit and update
Information acquisition unit.
Wherein, information detecting unit is updated to be used to whether detect application programming interface list that configuration center is loaded
There are updates.
Information acquisition unit is updated to be used to detect the application program that configuration center is loaded in update information detecting unit
Programming interface list is deposited in the case of an update, the application programming interface list of update is obtained, to answer according to described
The application programming interface for being included with Program Interfaces list is monitored the system control position.
In a further exemplary embodiment, target information obtains module 230 and specifically includes abnormal log output unit and different
Normal log acquisition unit.
Wherein, abnormal log output unit be used for monitor the system control position have printed it is opposite with browser kernel
When the unexpected message log answered, by call method, the unexpected message log is exported to same command line tool.
Abnormal log acquiring unit from the same command line tool for obtaining the unexpected message log.
In a further exemplary embodiment, webpage abnormal prompt module 250 specifically includes prompting frame and is loaded into unit and triggering
Detection unit.
Wherein, prompting frame is loaded into unit and is used to pop up exception information prompting frame in the webpage loaded.
Detection trigger unit is detecting the abnormal letter for detecting whether the exception information prompting frame is triggered
When breath prompting frame is triggered, controls documented webpage and jump to the exception error page.
It should be noted that method provided by device provided by above-described embodiment and above-described embodiment belongs to same structure
Think, the concrete mode that wherein modules execute operation is described in detail in embodiment of the method, no longer superfluous herein
It states.
In one exemplary embodiment, the application also provides a kind of electronic equipment, which includes:
Processor;
Memory is stored with computer-readable instruction on the memory, when which is executed by processor,
Realize the abnormality monitoring method of webpage load as previously described.
In one exemplary embodiment, the application also provides a kind of computer readable storage medium, is stored thereon with calculating
Machine program when the computer program is executed by processor, realizes the abnormality monitoring method of webpage load as previously described.
It should be understood that the application is not limited to the precise structure that has been described above and shown in the drawings, and
And various modifications and change can executed without departing from the scope.Scope of the present application is only limited by the accompanying claims.