Method and device for displaying webpage applicationTechnical Field
The invention relates to the field of internet, in particular to a method and a device for displaying webpage application.
Background
Early web pages are all pages composed of information such as characters and/or pictures, the information is static information, and the web pages can only display the static information, so that the functions provided by the web pages are single. In order to enrich the functions of the web page, the current web page can display the static information and also can display web applications, and the web applications can provide different functions for users. For example, some current microblog pages are divided into a left display area and a right display area; generally, information such as characters or pictures is displayed in a left display area, and a webpage application is displayed in a right display area, for example, a recommendation application is displayed in the right display area, and the recommendation application can recommend a recent hot microblog topic.
In order to display a web application in a web page, the following methods may be currently used, including: the method comprises the steps that a server generates a webpage in advance, all webpage applications included in the webpage are packaged into a class in the generation process, the class is called a first class for convenience of description, and the first class includes html (hyper text markup language) codes for realizing all the webpage applications; packaging html codes for realizing other contents included in the webpage page into another class, wherein the other class is called a second class for convenience; and forming the data file of the webpage by the packaged first class and the packaged second class. When the terminal requests the web page from the server, the server sends the data file of the web page to the terminal. The terminal receives the data file of the webpage and creates a blank webpage, and the webpage can comprise two columns of areas; rendering in a column area according to a first type in the data file so as to display all webpage applications in the webpage in the column area; rendering is carried out in another column area according to the second type in the data file, so that other content included in the webpage is displayed in the other column area.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
because the implementation codes of all the webpage applications included in the webpage are packaged in one class, the implementation codes of all the webpage applications are mutually dependent, and once the implementation code of a certain webpage application is wrong, the rendering of the whole webpage is influenced.
Disclosure of Invention
In order to solve the problems of the prior art, the invention provides a method and a device for displaying a webpage application. The technical scheme is as follows:
in one aspect, the present invention provides a method for displaying a web application, the method comprising:
receiving an acquisition request sent by a terminal, wherein the acquisition request carries a webpage identifier;
acquiring a source file of each webpage application included in the corresponding webpage according to the webpage identification, wherein the source file of each webpage application is respectively used for storing an implementation code of each webpage application;
and respectively sending the source file of each webpage application to the terminal, so that the terminal respectively renders each webpage application in a display interface according to the source file of each webpage application.
In another aspect, the present invention provides a method for displaying a web application, the method comprising:
sending an acquisition request to a server, wherein the acquisition request carries a webpage identifier of a webpage;
receiving a source file of each webpage application included in a webpage corresponding to the webpage identifier sent by the server;
and respectively rendering each webpage application in a display interface according to the source file of each webpage application.
In another aspect, the present invention provides an apparatus for displaying a web application, the apparatus comprising:
the first receiving module is used for receiving an acquisition request sent by a terminal, wherein the acquisition request carries a webpage identifier;
a first obtaining module, configured to obtain, according to the web page identifier, a source file of each web application included in a corresponding web page, where the source file of each web application is used to store an implementation code of each web application;
the first sending module is used for respectively sending the source file of each webpage application to the terminal, so that the terminal respectively renders each webpage application in a display interface according to the source file of each webpage application.
In another aspect, the present invention provides an apparatus for displaying a web application, the apparatus comprising:
the third sending module is used for sending an acquisition request to the server, wherein the acquisition request carries the webpage identifier of the webpage;
a second receiving module, configured to receive a source file of each web application included in a web page corresponding to the web page identifier sent by the server;
and the rendering module is used for rendering each webpage application in a display interface according to the source file of each webpage application.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for displaying a web application according to embodiment 1 of the present invention;
fig. 2 is a flowchart of a method for displaying a web application according to embodiment 2 of the present invention;
FIG. 3a is a flowchart of a method for displaying a web application according to embodiment 3 of the present invention;
FIG. 3b is a diagram of a display interface of a recently used web application according to embodiment 3 of the present invention;
fig. 3c is a display interface diagram for displaying a web application according to embodiment 3 of the present invention;
fig. 4 is a schematic structural diagram of an apparatus for displaying a web application according to embodiment 4 of the present invention;
fig. 5 is a schematic structural diagram of another apparatus for displaying a web application according to embodiment 5 of the present invention;
fig. 6 is a schematic device structure diagram of a server according to embodiment 6 of the present invention;
fig. 7 is a schematic structural diagram of a terminal according to embodiment 7 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Example 1
The embodiment of the invention provides a method for displaying a webpage application. Referring to fig. 1, wherein the method comprises:
step 101: receiving an acquisition request sent by a terminal, wherein the acquisition request carries a webpage identifier;
step 102: acquiring a source file of each webpage application included in the corresponding webpage according to the webpage identification, wherein the source file of each webpage application is respectively used for storing an implementation code of each webpage application;
step 103: and respectively sending the source file of each webpage application to the terminal, so that the terminal respectively renders each webpage application in the display interface according to the source file of each webpage application.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
Example 2
The embodiment of the invention provides a method for displaying a webpage application. Referring to fig. 2, wherein the method comprises:
step 201: sending an acquisition request to a server, wherein the acquisition request carries a webpage identifier of a webpage;
step 202: receiving a source file of each webpage application included in a webpage corresponding to a webpage identifier sent by a server;
step 203: and respectively rendering each webpage application in the display interface according to the source file of each webpage application.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
Example 3
The embodiment of the invention provides a method for displaying a webpage application. Referring to fig. 3a, wherein the method comprises:
step 301: the terminal sends an acquisition request to the server, wherein the acquisition request carries a webpage identifier;
the terminal is any terminal, for example, the terminal is a mobile phone terminal or a PC (personal computer) terminal. The web page identifier may be a URL (Uniform resource Locator) of the web page, etc.
When a user requests to open a webpage, the user submits an acquisition request to a terminal, wherein the acquisition request carries a webpage identifier; the terminal receives an acquisition request submitted by a user and sends the acquisition request to the server.
Step 302: the server receives an acquisition request sent by the terminal, and acquires a class corresponding to a webpage application included in a corresponding webpage according to a webpage identifier carried by the acquisition request;
step 302 may include the following steps (1) to (3):
(1) the server acquires the configuration file of the webpage from the corresponding relation between the stored webpage identification and the configuration file according to the webpage identification;
the configuration files contain the identification of each web application included in the web page, and one web page corresponds to one configuration file. The server stores the corresponding relationship between the webpage identification and the configuration file in advance, and the configuration file of the webpage corresponding to the webpage identification can be obtained from the corresponding relationship between the webpage identification and the configuration file according to the webpage identification.
(2) The server acquires the identification of the webpage application included in the webpage from the configuration file;
the configuration file comprises the identification of each webpage application included in the webpage, and the server acquires the identification of the webpage application included in the webpage from the configuration file.
The identification of the web application may be the name of the web application, etc. For example, the web application is a recommendation application, and the recommendation application may recommend recent hot topics.
For example, the identification of the web application included in the configuration file is an identification of a recommended application, an identification of a most recently used application, and an identification of a trending topic; the server acquires the identification of the recommended application, the identification of the latest use and the identification of the hot topics included in the webpage from the configuration file.
(3) And the server acquires the class corresponding to the webpage application according to the identification of the webpage application.
The classes are used for storing implementation codes of the webpage applications, and one webpage application corresponds to one class; moreover, one webpage application comprises at least one composition module, and each composition module is provided with a respective implementation code; and the server makes the implementation codes of all the constituent modules included by the webpage application into the implementation codes of the webpage application. The server packages the implementation code of each webpage application in a class in advance, and stores the corresponding relation between the identification of the webpage application and the class. The server can respectively acquire the class corresponding to each webpage application from the correspondence between the identification and the class of the webpage application according to the identification of each webpage application.
The webpage application comprises a composition module at least comprising application content, and the composition module also comprises an application title, a page turning module, an interaction module, a style module and/or a permission module. The application content is used for showing the content of the webpage application; the application title is used for showing the title of the webpage application; the page turning module is used for displaying page turning parameters and page turning buttons of the webpage application, and is not used for the webpage application with less content to be displayed, but is used for the webpage application with more content to be displayed, such as recommended application and the like; the interaction module is used for displaying interaction information and interaction buttons of the webpage application, and the interaction information of the webpage application can be set through the interaction module; the style module is used for displaying the style of the webpage application, different webpage applications can have different styles, and the style of the webpage application can be set through the style module; the permission module is used for controlling whether the webpage application has permission to appear, the common webpage application can be shown for each user, but some special webpage applications are only shown for part of users, and the part of users can be member users and the like.
Each composition module included in the webpage application corresponds to a section of implementation code so as to implement the corresponding function of the composition module. For example, the web application "recently used" is taken as an example for explanation, as shown in fig. 3 b. The "recently used" web application includes an application title, application content, and a page flip module. The application title of the "recently used" web application is recently used; the application content of the "recently used" web application is "daily tasks, micro-activities, gift blessings, papas, and picture votes". The page flip module of the "recently used" web application includes a page flip button and a page flip parameter of 3 pages.
The implementation code corresponding to the application title of the "recently used" web application is as follows:
the implementation code corresponding to the application content of the "recently used" web application is as follows:
the implementation code corresponding to the page turning module of the "recently used" web application is as follows:
the implementation codes corresponding to the application titles, the application contents and the page turning module of the 'most recently used' webpage application are combined into the implementation codes of the 'most recently used' webpage application as follows:
further, if the web page corresponding to the web page identifier carried by the acquisition request further includes non-web application information other than the web application, the server further acquires a source file corresponding to the non-web application information included in the web page, and sends the source file corresponding to the non-web application information to the terminal, where the source file is used for storing an implementation code corresponding to the non-web application information.
The non-web application information may be text information and/or picture information. In the server, the webpage identification of each webpage and the source file corresponding to the non-webpage application information included in each webpage are stored in the corresponding relation between the webpage identification and the source file in advance. After receiving an acquisition request sent by the terminal, the server acquires a source file corresponding to non-web application information included in a corresponding web page from the corresponding relationship between the web page identifier and the source file according to the web page identifier carried by the acquisition request.
For example, the server obtains the class corresponding to the recommended application according to the identifier of the recommended application, obtains the class corresponding to the recent use according to the identifier of the recent use, and obtains the class corresponding to the trending topic according to the identifier of the trending topic.
Step 303: the method comprises the steps that a server extracts implementation codes of a construction module included by a webpage application from a class corresponding to the webpage application;
step 303 may include the following steps (1) to (3):
(1) the server acquires a parent class inherited by the class corresponding to the webpage application;
the server respectively acquires the parent class inherited by the class corresponding to each webpage application according to the class corresponding to each webpage application.
The parent class of the class inheritance corresponding to the webpage application comprises an interface function corresponding to a composition module included by the webpage application; the realization codes corresponding to the constituent modules can be respectively extracted from the classes corresponding to the webpage applications through the interface functions corresponding to the constituent modules. The server encapsulates the interface function corresponding to the composition module included in the webpage application in a parent class in advance.
The interface function corresponding to the application content may be getContent (); the interface function corresponding to the application title may be getTitle (); the interface function corresponding to the page turning module may be getPage (); the interface function corresponding to the interaction module may be getJs (); the interface function corresponding to the style module may be geCss (); the interface function corresponding to the permission module may be functionLimit ().
The server may only encapsulate getContent () in the parent class in advance; alternatively, the server may package one or more of getTitle (), getPage (), getJs (), geCss (), and functionLimit () in the parent class in advance, along with getContent ().
For example, the server obtains a parent class that the class corresponding to the recommended application inherits, obtains a parent class that most recently uses the corresponding class inheritance, and obtains a parent class that the class corresponding to the trending topic inherits.
(2) The server calls an interface function corresponding to a composition module included in the webpage application from the parent class;
the server firstly determines the constituent modules needing to extract the implementation codes, and then calls the interface functions corresponding to the determined constituent modules from the parent class. The determined composition module at least comprises application content, and can also comprise an application identifier, a page turning module and/or an interaction module and the like.
For example, the server calls the interface function corresponding to the constituent module included in the recommended application from the parent class inherited by the class corresponding to the recommended application, calls the interface function corresponding to the constituent module included in the recent usage from the parent class inherited by the class corresponding to the recent usage, and calls the interface function corresponding to the constituent module included in the trending topic from the parent class inherited by the class corresponding to the trending topic.
(3) And the server extracts the implementation codes of the composition modules from the classes corresponding to the webpage applications through the interface functions corresponding to the composition modules.
The server can respectively extract the implementation codes of all the constituent modules included by the webpage application from the classes corresponding to the webpage application through the interface functions of all the constituent modules.
For example, the server may extract html code exposed by a content area included in the web application from the class of the web application through an interface function getContent () corresponding to the application content; html codes displayed in a title area included by the webpage application can be extracted from the class through an interface function getTitle () corresponding to the title module; html code of interaction included by the web application can be extracted from the class by getJs (); html code of a style included by the web application can be extracted from the class by getCss (); html code showing the rights included by the web application can be extracted from the class through the functionLimit ().
If so, the server extracts the implementation codes of the composition modules from the classes corresponding to the recommended applications through the interface functions corresponding to the composition modules included in the recommended applications; extracting the recently used implementation codes from the recently used corresponding classes through the interface functions corresponding to the recently used composition modules; and extracting the realization codes of the hot topics from the classes corresponding to the hot topics through the interface functions corresponding to the composition modules included in the hot topics.
Step 304: the server makes implementation codes of the construction modules included by the webpage application form a source file of the webpage application;
the server extracts the realization codes of the composition modules from the classes corresponding to the webpage application through the interface functions corresponding to the composition modules, and the realization codes of the composition modules form a source file of the webpage application.
For each web application included in the web page, the server obtains the source file of each web application in accordance with the above steps 302 to 304.
For example, the server composes the implementation codes of the constituent modules included in the recommendation application into the source file of the recommendation application, composes the implementation codes of the constituent modules included in the latest usage into the source file of the latest usage, and composes the implementation codes of the constituent modules included in the trending topic into the source file of the trending topic.
Step 305: the server sends a source file of the webpage application to the terminal;
the server sends a source file of a web application each time the server acquires the source file of the web application.
The server can also obtain the display position of the webpage application and send the source file and the display position of the webpage application to the terminal.
For example, the server sends a source file of a recommended application, a source file used recently, and a source file of a trending topic to the terminal, respectively.
Step 306: the terminal receives a source file of the webpage application sent by the server and acquires a display position of the webpage application;
the terminal can acquire the display position of the webpage application in a first mode or a second mode. For the first way, it can be:
and the terminal receives the display position of the webpage application sent by the server.
For the second way, it can be:
when the terminal receives the source file of the webpage application, the terminal determines the display position of the received webpage application according to the display position of the rendered webpage application.
The terminal acquires a next display position closest to the rendered webpage application position according to the rendered webpage application display position, and determines the acquired position as the received webpage application display position. And if the rendered webpage application does not exist, the terminal acquires the first display position and determines the first display position as the display position of the received webpage application.
After the terminal sends the acquisition request to the server, if the terminal also receives a source file corresponding to the non-webpage application information, the terminal creates a blank display interface, and the display interface comprises a non-application display area and an application display area. And the terminal renders the non-webpage application information in a non-application display area included in the display interface according to the source file corresponding to the non-webpage application information.
For example, the terminal receives a source file of a recommended application, a source file used recently, and a source file of a trending topic sent by the server, and acquires a display position of the recommended application, a display position used recently, and a display position of the trending topic.
Step 307: and rendering the webpage application in an application display area of the display interface by the terminal according to the source file and the display position of the webpage application.
And the terminal acquires the application display area and renders the webpage application according to the source file and the display position of the webpage application in the application display area of the display interface.
And the server sends the source file of the webpage application to the terminal every time the server acquires the source file of the webpage application. The terminal renders a web application in the display interface according to the steps of the above steps 305 to 307 every time the terminal receives the web application.
The terminal renders the recommended application in an application display area of a display interface according to a source file and a display position of the recommended application; rendering the latest usage in an application display area of the display interface according to the latest usage source file and the display position; and rendering the trending topic in an application display area of the display interface according to the source file and the display position of the trending topic. A display interface as shown in FIG. 3c, the display interface including a non-application display area on the left side and an application display area on the right side; the non-webpage application information is friend dynamic information of the user; the web application information includes recommended applications, recent uses, and trending topics.
The method comprises the steps that a terminal obtains rendering time of each webpage application, and if the rendering time of the webpage application is larger than a preset threshold value or the webpage application is abnormal, the terminal sends a notification message to a server, wherein the notification message carries an identifier of the webpage application; and the server receives the notification message sent by the terminal and performs error detection processing on the source file of the webpage application according to the identification of the webpage application.
The preset threshold value can be set and changed as required.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
Example 4
The embodiment of the invention provides a device for displaying a webpage application. Referring to fig. 4, wherein the apparatus comprises:
a first receiving module 401, configured to receive an acquisition request sent by a terminal, where the acquisition request carries a web page identifier;
a first obtaining module 402, configured to obtain, according to the web page identifier, a source file of each web application included in the corresponding web page, where the source file of each web application is used to store an implementation code of each web application;
the first sending module 403 is configured to send the source file of each web application to the terminal, so that the terminal renders each web application in the display interface according to the source file of each web application.
Further, the first obtaining module 402 includes:
the first acquisition unit is used for acquiring a class corresponding to the webpage application included in the corresponding webpage according to the webpage identification, wherein the class is packaged with an implementation code of the webpage application;
the extraction unit is used for extracting implementation codes of the construction modules included by the webpage application from the class corresponding to the webpage application;
and the composition unit is used for composing the implementation codes of the composition modules included by the webpage application into a source file of the webpage application.
Further, an extraction unit comprising:
the first acquiring subunit is used for acquiring a parent class inherited by a class corresponding to the web application, wherein the parent class comprises at least one interface function, and the interface function is used for extracting an implementation code of a composition module included by the web application;
the calling subunit is used for calling the interface function corresponding to the composition module included in the webpage application from the parent class;
and the extraction subunit is used for extracting the implementation codes of the composition modules from the classes corresponding to the webpage applications through the interface functions corresponding to the composition modules.
Further, the first obtaining unit includes:
the second acquiring subunit is used for acquiring the configuration file of the webpage from the corresponding relation between the stored webpage identifier and the configuration file according to the webpage identifier;
the third acquiring subunit is used for acquiring the identifier of the web application included in the web page from the configuration file;
and the fourth acquiring subunit is used for acquiring the class corresponding to the webpage application according to the identifier of the webpage application.
Further, the apparatus further comprises:
the second acquisition module is used for acquiring the display position of each webpage application;
and the second sending module is used for sending the display position of each webpage application to the terminal, so that the terminal respectively renders each webpage application in the application display area of the display interface according to the source file and the display position of each webpage application.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
Example 5
The embodiment of the invention provides a device for displaying a webpage application. Referring to fig. 5, wherein the apparatus comprises:
a third sending module 501, configured to send an obtaining request to a server, where the obtaining request carries a web page identifier of a web page;
a second receiving module 502, configured to receive a source file of each web application included in a web page corresponding to a web page identifier sent by a server;
the rendering module 503 is configured to render each web application in the display interface according to the source file of each web application.
Further, the rendering module 503 includes:
a second acquisition unit configured to acquire a display position of each web application;
and the rendering unit is used for rendering each webpage application in the display interface according to the display position of each webpage application and the source file of each webpage application.
Further, the second obtaining unit is used for receiving the display position of each webpage application sent by the server; or,
and the second acquisition unit is used for determining the display position of the received webpage application according to the display position of the rendered webpage application when receiving the source file of the webpage application sent by the server.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
Example 6
Fig. 6 is a schematic structural diagram of a server according to an embodiment of the present invention. The server 1900, which may vary widely in configuration or performance, may include one or more Central Processing Units (CPUs) 1922 (e.g., one or more processors) and memory 1932, one or more storage media 1930 (e.g., one or more mass storage devices) storing applications 1942 or data 1944. Memory 1932 and storage medium 1930 can be, among other things, transient or persistent storage. The program stored in the storage medium 1930 may include one or more modules (not shown), each of which may include a series of instructions operating on a server. Still further, a central processor 1922 may be provided in communication with the storage medium 1930 to execute a series of instruction operations in the storage medium 1930 on the server 1900.
The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input-output interfaces 1958, one or more keyboards 1956, and/or one or more operating systems 1941, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
Server 1900 may include memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors include instructions for:
receiving an acquisition request sent by a terminal, wherein the acquisition request carries a webpage identifier;
acquiring a source file of each webpage application included in the corresponding webpage according to the webpage identification, wherein the source file of each webpage application is respectively used for storing an implementation code of each webpage application;
and respectively sending the source file of each webpage application to the terminal, so that the terminal respectively renders each webpage application in a display interface according to the source file of each webpage application.
Further, the obtaining a source file of each web application included in the corresponding web page according to the web page identifier includes:
acquiring a class corresponding to a webpage application included in a corresponding webpage according to the webpage identification, wherein the class encapsulates an implementation code of the webpage application;
extracting implementation codes of the composition modules included by the webpage application from the class corresponding to the webpage application;
and composing the implementation codes of the composition modules included by the webpage application into a source file of the webpage application.
Further, the extracting, from the class corresponding to the web application, implementation code of a constituent module included in the web application includes:
acquiring a parent class inherited by a class corresponding to the webpage application, wherein the parent class comprises at least one interface function, and the interface function is used for extracting an implementation code of a composition module included in the webpage application;
calling an interface function corresponding to a composition module included in the webpage application from the parent class;
and extracting the implementation codes of the composition modules from the classes corresponding to the webpage applications through the interface functions corresponding to the composition modules.
Further, the obtaining the class of the web application included in the corresponding web page according to the web page identifier includes:
acquiring a configuration file of the webpage from the corresponding relation between the stored webpage identification and the configuration file according to the webpage identification;
acquiring an identifier of a webpage application included in the webpage from the configuration file;
and acquiring the class corresponding to the webpage application according to the identification of the webpage application.
Further, the method further comprises:
and acquiring the display position of each webpage application, and sending the display position of each webpage application to the terminal, so that the terminal respectively renders each webpage application in an application display area of the display interface according to the source file and the display position of each webpage application.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
Example 7
Referring to fig. 7, a schematic structural diagram of a terminal with a touch-sensitive surface according to an embodiment of the present invention is shown, where the terminal may be used to implement the method for verification of an authentication code provided in the foregoing embodiment. Specifically, the method comprises the following steps:
the terminal 900 may include RF (Radio Frequency) circuitry 110, memory 120 including one or more computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, audio circuitry 160, a WiFi (wireless fidelity) module 170, a processor 180 including one or more processing cores, and a power supply 190. Those skilled in the art will appreciate that the terminal structure shown in fig. 7 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information from a base station and then sends the received downlink information to the one or more processors 180 for processing; in addition, data relating to uplink is transmitted to the base station. In general, the RF circuitry 110 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuitry 110 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (short messaging Service), etc.
The memory 120 may be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by operating the software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal 900, and the like. Further, the memory 120 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 120 may further include a memory controller to provide the processor 180 and the input unit 130 with access to the memory 120.
The input unit 130 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 130 may include a touch-sensitive surface 131 as well as other input devices 132. The touch-sensitive surface 131, also referred to as a touch display screen or a touch pad, may collect touch operations by a user on or near the touch-sensitive surface 131 (e.g., operations by a user on or near the touch-sensitive surface 131 using a finger, a stylus, or any other suitable object or attachment), and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface 131 may comprise two parts, a touch detection means and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. Additionally, the touch-sensitive surface 131 may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch-sensitive surface 131, the input unit 130 may also include other input devices 132. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 140 may be used to display information input by or provided to a user and various graphical user interfaces of the terminal 900, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 140 may include a Display panel 141, and optionally, the Display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and when a touch operation is detected on or near the touch-sensitive surface 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of the touch event. Although in FIG. 7, touch-sensitive surface 131 and display panel 141 are shown as two separate components to implement input and output functions, in some embodiments, touch-sensitive surface 131 may be integrated with display panel 141 to implement input and output functions.
The terminal 900 can also include at least one sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 141 and/or the backlight when the terminal 900 is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal 900, detailed descriptions thereof are omitted.
Audio circuitry 160, speaker 161, and microphone 162 may provide an audio interface between a user and terminal 900. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 160, and then outputs the audio data to the processor 180 for processing, and then to the RF circuit 110 to be transmitted to, for example, another terminal, or outputs the audio data to the memory 120 for further processing. The audio circuitry 160 may also include an earbud jack to provide communication of peripheral headphones with the terminal 900.
WiFi belongs to a short-distance wireless transmission technology, and the terminal 900 can help a user send and receive e-mails, browse web pages, access streaming media, and the like through the WiFi module 170, and it provides wireless broadband internet access for the user. Although fig. 7 shows the WiFi module 170, it is understood that it does not belong to the essential constitution of the terminal 900 and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 180 is a control center of the terminal 900, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the terminal 900 and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby performing overall monitoring of the mobile phone. Optionally, processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
Terminal 900 also includes a power supply 190 (e.g., a battery) for powering the various components, which may preferably be logically coupled to processor 180 via a power management system that may be used to manage charging, discharging, and power consumption. The power supply 190 may also include any component including one or more of a dc or ac power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the terminal 900 may further include a camera, a bluetooth module, etc., which will not be described herein. Specifically, in this embodiment, the display unit of the terminal 900 is a touch screen display, the terminal 900 further includes a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for:
sending an acquisition request to a server, wherein the acquisition request carries a webpage identifier of a webpage;
receiving a source file of each webpage application included in a webpage corresponding to the webpage identifier sent by the server;
and respectively rendering each webpage application in a display interface according to the source file of each webpage application.
Further, the rendering each web application in a display interface according to the source file of each web application includes:
acquiring the display position of each webpage application;
and respectively rendering each webpage application in a display interface according to the display position of each webpage application and the source file of each webpage application.
Further, the obtaining the location identifier of each web application includes:
receiving the display position of each webpage application sent by the server; or,
when a source file of a webpage application sent by the server is received, the display position of the received webpage application is determined according to the display position of the rendered webpage application.
In the embodiment of the invention, the implementation codes of each webpage application are respectively packaged in one class, the implementation codes of the webpage applications are not mutually dependent, even if the implementation code of one webpage application is wrong, the rendering of other webpage applications is not influenced, in addition, the server sends the source file of one webpage application to the terminal every time the server acquires the source file of one webpage application, and the terminal renders one webpage application in the display interface every time the terminal receives the source file of one webpage application, so the display speed of the webpage can be improved.
It should be noted that: in the device for displaying a web application according to the above embodiment, when displaying a web application, only the division of the above functional modules is taken as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the apparatus for displaying a web application and the method embodiment for displaying a web application provided in the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and will not be described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.