CN114238813A - Single-page version updating method and device, electronic equipment and storage medium - Google Patents

Single-page version updating method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114238813A
CN114238813A CN202111534113.6A CN202111534113A CN114238813A CN 114238813 A CN114238813 A CN 114238813A CN 202111534113 A CN202111534113 A CN 202111534113A CN 114238813 A CN114238813 A CN 114238813A
Authority
CN
China
Prior art keywords
page
version
thread
website
tag
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111534113.6A
Other languages
Chinese (zh)
Inventor
胡衍生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202111534113.6A priority Critical patent/CN114238813A/en
Publication of CN114238813A publication Critical patent/CN114238813A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Transfer Between Computers (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The disclosure relates to a single-page version updating method and device, electronic equipment and a storage medium. The method comprises the following steps: receiving a website version update message sent by a working thread through a main thread of a browser tag page, wherein the working thread is used for detecting the update of the website version; and responding to the message, and switching the currently displayed tag page to a new version tag page by the main thread. The method and the device for detecting the version updating of the website can detect the version updating of the website in real time, and solve the problem that the version updating is difficult due to the fact that a single-page application page is skipped and is not refreshed.

Description

Single-page version updating method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method and an apparatus for updating a version of a single page, an electronic device, and a storage medium.
Background
With the development of internet technology, Single Page Application (SPA) has emerged. Through the single-page application, when a user browses a webpage, the user can directly obtain the content of a new page without refreshing the page when the page jumps. Due to the fact that the time for page jumping is saved, the single-page application enables a user to obtain better use experience. However, if the single-page application does not refresh the page (i.e. does not send an HTTP request to the site) when the page jump is implemented, it is necessary to load the related contents (such as an HTML tag, a JavaScript script, etc.) of other pages at the same time when the first page is loaded, and perform caching. The cache causes that the skipped page cannot timely sense the update of the page version, and in the related technology, the resource update is realized by customizing a complex update strategy, and the update of the version cannot be timely sensed.
Disclosure of Invention
The present disclosure provides a single-page version updating method, apparatus, electronic device and storage medium, so as to at least solve the problem that version updating cannot be performed in time in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a single-page version updating method, including:
receiving a website version update message sent by a working thread through a main thread of a browser tag page, wherein the working thread is used for detecting the update of the website version;
and responding to the message, and switching the currently displayed tag page to a new version tag page by the main thread.
In one possible implementation, the switching, by the main thread in response to the message, the currently-presented tab page to a new version tab page includes:
in response to the message, the main thread marks the currently displayed tag page as a state to be updated;
and responding to a switching instruction of the tag page, and switching the tag page in the state to be updated to a new version of tag page.
In a possible implementation manner, the switching the tab page in the state to be updated to a new version of the tab page in response to the switching instruction of the tab page includes:
in response to a switching instruction of a tag page, intercepting a default access path to be jumped by the tag page in the state to be updated;
and acquiring an access path corresponding to the new version of the tag page, and replacing the default access path with the access path to switch to the new version of the tag page.
In one possible implementation, the switching, by the main thread in response to the message, the currently-presented tab page to a new version tab page includes:
in response to the message, the main thread presents a prompt for a website version update;
and responding to a trigger instruction generated by a user selecting an updated version according to the prompt, and switching the currently displayed tag page to a new version tag page by the main thread.
In a possible implementation manner, the worker thread is further configured to send the updated message to a plurality of main threads corresponding to a plurality of tab pages of the browser, and before the receiving, by the main thread of the tab page of the browser, the message that the website version is updated and sent by the worker thread, the method further includes:
when the label page is jumped to, detecting whether to start a working thread of version updating or not through a main thread corresponding to the label page;
and if the working thread is started, the main thread is connected with the working thread to receive the message sent by the working thread.
In one possible implementation, the worker thread is also used for
After detecting that the website version is updated, sending a hypertext transmission request to a website server;
receiving a hypertext markup language file returned by the website server;
analyzing the hypertext markup language file to obtain a plurality of scripts and static file resources corresponding to the preloaded links;
the main thread switches the currently displayed tag page to a new version tag page, and the method comprises the following steps:
and the main thread switches the currently displayed label page to a new version label page according to the scripts and the static file resources.
In a possible implementation manner, before the worker thread performs the update of the detected website version, the worker thread is further configured to load an access path corresponding to an object file of the worker thread to call the object file, where the object file is used to describe a program, which is executed by the worker thread, for detecting the update of the website version.
According to a second aspect of the embodiments of the present disclosure, there is provided a version updating apparatus for a single page, including:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a website version updating message sent by a working thread through a main thread of a browser tag page, and the working thread is used for detecting the updating of the website version;
and the switching module is used for responding to the message, and the main thread switches the currently displayed tag page to a new version of tag page.
In one possible implementation, the switching module includes:
the marking submodule is used for responding to the message, and the main thread marks the currently displayed tag page as a state to be updated;
and the first switching submodule is used for responding to a switching instruction of the tag page and switching the tag page in the state to be updated to the new version of the tag page.
In one possible implementation, the switching sub-module includes:
the intercepting unit is used for responding to a switching instruction of the tag page and intercepting a default access path to be jumped by the tag page in the state to be updated;
and the switching unit is used for acquiring an access path corresponding to the new version of the tag page, and replacing the default access path with the access path to switch to the new version of the tag page and switch to the new version of the tag page.
In one possible implementation, the switching module includes:
the display sub-module is used for responding to the message, and the main thread displays a prompt of website version updating;
and the second switching submodule is used for responding to a trigger instruction generated by a user selecting an updated version according to the prompt, and the main thread switches the currently displayed tag page to the tag page of the new version.
In a possible implementation manner, the worker thread is further configured to send the updated message to a plurality of main threads corresponding to a plurality of tab pages of the browser, and the method further includes:
the detection module is used for detecting whether a working thread for version updating is started or not through a main thread corresponding to the tag page when the tag page is jumped to;
and the connection module is used for connecting the main thread with the working thread to receive the message sent by the working thread if the working thread is started.
In a possible implementation manner, the working thread is further configured to send a hypertext transfer request to the website server after detecting that the website version is updated;
receiving a hypertext markup language file returned by the website server;
analyzing the hypertext markup language file to obtain a plurality of scripts and static file resources corresponding to the preloaded links;
the switching module includes:
and the third switching sub-module is used for switching the currently displayed label page to a new version label page by the main thread according to the scripts and the static file resources.
In a possible implementation manner, before the worker thread performs the update of the detected website version, the worker thread is further configured to load an access path corresponding to an object file of the worker thread to call the object file, where the object file is used to describe a program, which is executed by the worker thread, for detecting the update of the website version.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the single-page version update method according to any one of the embodiments of the present disclosure.
According to a fourth aspect of embodiments of the present disclosure, a computer-readable storage medium is provided. The instructions in the computer readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform a single page version update method as in any of the embodiments of the present disclosure.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product, which includes instructions, and when executed by a processor of an electronic device, enables the electronic device to execute the version updating method of a single page according to any one of the embodiments of the present disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: the embodiment of the disclosure detects the update of the website version through the working thread of the browser, and sends the message of updating the website version to the main thread. And responding to the message, and switching the currently displayed tag page to a new version tag page by the main thread. The method and the device for detecting the version updating of the website can detect the version updating of the website in real time, and solve the problem that the version updating is difficult due to the fact that a single-page application page is skipped and is not refreshed. And the task of updating the website version is executed by using the working thread, and the main thread can keep the task of the user interface interaction of the process and cannot be blocked or dragged slowly.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flowchart illustrating a single page version update method according to an example embodiment.
Fig. 2 is a block diagram illustrating a single-page version updating apparatus according to an exemplary embodiment.
FIG. 3 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in the present disclosure are both information and data that are authorized by the user or sufficiently authorized by various parties.
Fig. 1 is a flowchart illustrating a single-page version updating method according to an exemplary embodiment, which is used in a terminal device, as shown in fig. 1, and includes the following steps.
Step S103, receiving a website version update message sent by a working thread through a main thread of a browser tab page, wherein the working thread is used for detecting the update of the website version.
In the embodiment of the present disclosure, the tab page includes a plurality of web pages opened by a browser window. The main threads comprise threads which are responsible for user interface interaction tasks in a wide area network thread (Web Worker), and each main thread corresponds to one tag page. The main thread may create a Worker thread, such as a Worker thread, a Shared-Worker thread, and the like. The working thread runs in the background, and the main thread and the working thread are not interfered with each other.
In an embodiment of the present disclosure, the worker thread is used to detect updates of the website version. In one example, a version identification (e.g., version number) of the website is injected at the time of program compilation of the worker thread. And the working thread acquires the version identification of the website in real time, and if the acquired version identification is different from the stored version identification and is the upgrading version of the stored version identification, the version of the website is determined to be updated. In one example, the worker thread sends data requests to the web server in a polling manner, for example, once every second, and if the web version is found to be updated, sends an update message to the main thread of the tab page.
In the embodiment of the disclosure, when the worker thread detects the website version update, the worker thread sends the message of the website version update to the main thread. Postmessage () function, in one example, is utilized by a worker thread to send a message to the main thread, such as: postmessage ({ method: 'echo', args: [ 'Work' ] }). In another example, the main thread uses worker. On message ═ function (event) { dosemeting (event. data); document message ('Version update!'); }.
Step S105, in response to the message, the main thread switches the currently displayed tab page to a new version of tab page.
In the disclosed embodiment, after the worker thread detects the website version update, in one example, the worker thread may automatically download the updated website version resource. In another example, after receiving the website version update message, the main thread may also automatically download the updated website version resource. In one example, in response to the message of updating the website book, the main thread marks the currently displayed tab page as a state to be updated, receives a switching instruction of the tab page, and switches the currently displayed tab page to a new version of the tab page in response to the switching instruction. In another example, in response to the website version update message, the main thread may present the website version update message on the user interface, and switch the currently presented tab page to the new version tab page after receiving an instruction of the user to confirm the update.
The embodiment of the disclosure detects the update of the website version through the working thread of the browser, and sends the message of updating the website version to the main thread. And responding to the message, and switching the currently displayed tag page to a new version tag page by the main thread. The method and the device for detecting the version updating of the website can detect the version updating of the website in real time, and solve the problem that the version updating is difficult due to the fact that a single-page application page is skipped and is not refreshed. And the task of updating the website version is executed by using the working thread, and the main thread can keep the task of the user interface interaction of the process and cannot be blocked or dragged slowly.
In one possible implementation, the switching, by the main thread in response to the message, the currently-presented tab page to a new version tab page includes:
in response to the message, the main thread marks the currently displayed tag page as a state to be updated;
and responding to a switching instruction of the tag page, and switching the tag page in the state to be updated to a new version of tag page.
In the embodiment of the present disclosure, the state to be updated may be represented by preset characters or numbers, for example, a number "1" represents that a tag page is in a state to be updated; the number "0" indicates that the tab page is in a non-updated state. The switching instruction of the tab page may be triggered by a user, for example, the user clicks a link corresponding to "next" in the currently displayed tab page. For another example, a user searches a certain keyword in a currently displayed tag page and clicks for searching; or the user slides the current user interface, etc. In response to the switching instruction of the tab page, the main thread may determine, from the downloaded website resources of the new version, resources corresponding to the tab page to which the currently displayed tab page is to be skipped, and display the tab page of the new version.
According to the embodiment of the disclosure, the currently displayed tag page is marked as the state to be updated, and when the switching instruction of the tag page is received, the user jumps to the tag page of the new version, so that the problem of user data loss caused by instant jump can be avoided, for example, the instant jump may cause data loss previously input by the user in an ongoing payment interface of the user. The use experience of the user is improved.
In a possible implementation manner, the switching the tab page in the state to be updated to a new version of the tab page in response to the switching instruction of the tab page includes:
in response to a switching instruction of a tag page, intercepting a default access path to be jumped by the tag page in the state to be updated;
and acquiring an access path corresponding to the new version of the tag page, and replacing the default access path with the access path to switch to the new version of the tag page.
In the embodiment of the present disclosure, the default access path includes an access path corresponding to a tab page to be skipped to by a tab page in a state to be updated without version updating, and a resource corresponding to the tab page is a pre-stored resource, instead of a new version website resource acquired this time. In the embodiment of the disclosure, a switching instruction of a tab page can be monitored through a pop () function, and when the tab page is switched, a pop event is triggered. In an example, the default access path may be pushed to the history cache of the browser by using a pushState () function, for example:
var state=({url:~href,title:~title,~additionalKEY:~additionalVALUE});
window.history.pushState(state,~title,~href);
the sign with- "is self-defined content, and the function can push-href (URL) to the history of the browser. In one example, the default access path may also be replaced with a repolacestate () function, such as: store, replay State (state, title, href).
According to the embodiment of the disclosure, the main thread can determine the access path corresponding to the tag page of the new version from the downloaded website resource of the new version, and switch to the tag page of the new version through the access path.
The embodiment of the disclosure can automatically switch to the new version of the tag page by intercepting the access path of the default tag page and updating the access path to be jumped to the currently displayed tag page.
In one possible implementation, the switching, by the main thread in response to the message, the currently-presented tab page to a new version tab page includes:
in response to the message, the main thread presents a prompt for a website version update;
and responding to a trigger instruction generated by a user selecting an updated version according to the prompt, and switching the currently displayed tag page to a new version tag page by the main thread.
In the embodiment of the present disclosure, in response to the message, the main thread may prompt the user that the website has a new version, whether the website is updated to the new version, and the like in a manner of a popup window, a floating layer, and the like. The user may manually select the updated version, e.g., click a "yes" tab in the prompt, indicating that the new version of the website is updated; and clicking a No label in the prompt to show that the new version of the website is not updated and the existing website version is kept. In the embodiment of the present disclosure, the main thread may switch the currently displayed tab page to the tab page of the new version by using any switching method in the above embodiments, which is not described herein again.
The embodiment of the disclosure can provide a prompt for updating the website version for the user, and the user determines whether to update the version of the new website, so that the interaction with the user is increased, and the autonomous selection function of the user is increased.
In a possible implementation manner, the worker thread is further configured to send the updated message to a plurality of main threads corresponding to a plurality of tab pages of the browser, and before the receiving, by the main thread of the tab page of the browser, the message that the website version is updated and sent by the worker thread, the method further includes:
when the label page is jumped to, detecting whether to start a working thread of version updating or not through a main thread corresponding to the label page;
and if the working thread is started, the main thread is connected with the working thread to receive the message sent by the working thread.
In the embodiment of the disclosure, sharedWorker can be used as a working thread, so that a plurality of main threads corresponding to a plurality of tag pages can share the same working thread and share resource data. Specifically, when jumping to a tab page, the main thread of the tab page is correspondingly started. The main thread detects whether a working thread with updated version is started by the label page which is started before, if the working thread is started before, the main thread is connected with the working thread, and receives the message sent by the working thread. For example, a tab page a, a tab page b, and a tab page c are opened in the browser user interface, after jumping to the tab page d, a main thread corresponding to the tab page d detects the start condition of a working thread, and if the working thread is already started when the tab page c is opened, the tab page d only needs to be connected with the working thread, and a new working thread does not need to be created. If one of the previous tab pages a, b and c closes the working thread, the working thread can be opened through the main thread of the tab page d. In one example, the main thread and the worker thread may be implemented by onconnect. For example: in the object file of SharedWorker.
//Shared.js
Onconnect=function(e){
Var port=e.ports[0];
Port.postMessage(Version update!);}
According to the embodiment of the disclosure, the working thread is further used for sending the updated message to the plurality of main threads corresponding to the plurality of tab pages of the browser respectively, and the plurality of main threads communicate with the working thread in a connection mode, so that the browser resource can be saved, and the operating efficiency can be improved.
In one possible implementation, the worker thread is also used for
After detecting that the website version is updated, sending a hypertext transmission request to a website server;
receiving a hypertext markup language file returned by the website server;
analyzing the hypertext markup language file to obtain a plurality of scripts and static file resources corresponding to the preloaded links;
the main thread switches the currently displayed tag page to a new version tag page, and the method comprises the following steps:
and the main thread switches the currently displayed label page to a new version label page according to the scripts and the static file resources.
In the embodiment of the present disclosure, the worker thread is further configured to send a hypertext transfer request (http request) to the website server after detecting that the website version is updated, so as to obtain the website resource after the website version is updated. A hypertext markup language file (HTML file) returned by the web server is requested. In one example, a resource structure of an HTML file is constructed using a Document Object Model (DOM), and a script file in the hypertext markup language and all preloaded links are queried by a querySector api function. In one example, a XmlHttpRequest function can be utilized to issue requests to these preload links to preload static file resources in advance. And the main thread switches the currently displayed label page to a new version label page according to the scripts and the static file resources.
According to the embodiment of the disclosure, the resource of the new version website is updated in a background silent manner through the working thread, so that the interactive work of the main thread of the tag page is not influenced. All resources of the new version website are loaded through the working thread, and the single-page application is guaranteed to be smoother when the page jumps.
In a possible implementation manner, before the worker thread performs the update of the detected website version, the worker thread is further configured to load an access path corresponding to an object file of the worker thread to call the object file, where the object file is used to describe a program, which is executed by the worker thread, for detecting the update of the website version.
In the embodiment of the present disclosure, the object file of the worker thread is used to describe a program executed by the worker thread for detecting website version update, that is, a program logic to be executed by the worker thread. In one example, an object file for the worker thread may be stored on a server and an access path to access the object file may be generated. Different browsers want to run the program of the object file, and only the access path needs to be loaded. In a possible implementation manner, in the single-page version updating method, in an application stage, a front-end project is deployed under a back-end project, and the problem of cross-domain is avoided. If the updating method needs to locally test a plurality of front-end projects with different IP addresses in a research and development stage, a cross-domain problem exists, forwarding can be realized through a node server, and the node server is used as a middleware to forward a front-end interface request to a real back-end interface.
In one example, different file identifications may be used for different object files, for example, the file identification of the object file is obtained by shared-worker. Therefore, the website can open the object file of the only work thread every time the website releases a new version. In one example, in consideration of the same source restriction, that is, an object file run by a worker thread needs to be the same as a domain name of a file run by a main thread, a worker-loader plug-in a browser tool (webpack) can be rewritten, and an access path of the object file of the worker thread is set, so that different browsers do not need to re-edit program codes in the object file, and update detection of a website version is achieved by accessing the same object file.
According to the embodiment of the disclosure, different user browsers can also update versions of the object files by loading the object files of the working threads, and each browser loads the object file matched with the browser, so that real-time detection and update of website versions of displayed label pages of different browsers are realized.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in the figures may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the steps or stages is not necessarily sequential, but may be performed alternately or in alternation with other steps or at least some of the other steps or stages.
It is understood that the same/similar parts between the embodiments of the method described above in this specification can be referred to each other, and each embodiment focuses on the differences from the other embodiments, and it is sufficient that the relevant points are referred to the descriptions of the other method embodiments.
Fig. 2 is a block diagram illustrating a single-page version updating apparatus according to an exemplary embodiment. Referring to fig. 2, there is provided a version updating apparatus for a single page, including:
a receiving module 201, configured to receive, through a main thread of a browser tab page, a website version update message sent by a worker thread, where the worker thread is used to detect an update of a website version;
and the switching module 203 is configured to, in response to the message, switch the currently displayed tab page to a new version of tab page by the main thread.
In one possible implementation, the switching module includes:
the marking submodule is used for responding to the message, and the main thread marks the currently displayed tag page as a state to be updated;
and the first switching submodule is used for responding to a switching instruction of the tag page and switching the tag page in the state to be updated to the new version of the tag page.
In one possible implementation, the switching sub-module includes:
the intercepting unit is used for responding to a switching instruction of the tag page and intercepting a default access path to be jumped by the tag page in the state to be updated;
and the switching unit is used for acquiring an access path corresponding to the new version of the tag page, and replacing the default access path with the access path to switch to the new version of the tag page.
In one possible implementation, the switching module includes:
the display sub-module is used for responding to the message, and the main thread displays a prompt of website version updating;
and the second switching submodule is used for responding to a trigger instruction generated by a user selecting an updated version according to the prompt, and the main thread switches the currently displayed tag page to the tag page of the new version.
In a possible implementation manner, the worker thread is further configured to send the updated message to a plurality of main threads corresponding to a plurality of tab pages of the browser, and the method further includes:
the detection module is used for detecting whether a working thread for version updating is started or not through a main thread corresponding to the tag page when the tag page is jumped to;
and the connection module is used for connecting the main thread with the working thread to receive the message sent by the working thread if the working thread is started.
In a possible implementation manner, the working thread is further configured to send a hypertext transfer request to the website server after detecting that the website version is updated;
receiving a hypertext markup language file returned by the website server;
analyzing the hypertext markup language file to obtain a plurality of scripts and static file resources corresponding to the preloaded links;
the switching module includes:
and the third switching sub-module is used for switching the currently displayed label page to a new version label page by the main thread according to the scripts and the static file resources.
In a possible implementation manner, before the worker thread performs the update of the detected website version, the worker thread is further configured to load an access path corresponding to an object file of the worker thread to call the object file, where the object file is used to describe a program, which is executed by the worker thread, for detecting the update of the website version.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 3 is a block diagram illustrating an electronic device 300 applying a version update method of a single page according to an example embodiment. For example, the electronic device 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a gaming console, a tablet device, a medical device, a fitness device, a personal digital assistant, and so forth.
Referring to fig. 3, electronic device 300 may include one or more of the following components: processing component 302, memory 304, power component 306, multimedia component 308, audio component 310, input/output (I/O) interface 312, sensor component 314, and communication component 316.
The processing component 302 generally controls overall operations of the electronic device 300, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 302 may include one or more processors 320 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 302 can include one or more modules that facilitate interaction between the processing component 302 and other components. For example, the processing component 302 may include a multimedia module to facilitate interaction between the multimedia component 308 and the processing component 302.
The memory 304 is configured to store various types of data to support operations at the electronic device 300. Examples of such data include instructions for any application or method operating on the electronic device 300, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 304 may be implemented by any type or combination of volatile or non-volatile storage devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, optical disk, or graphene memory.
The power supply component 306 provides power to the various components of the electronic device 300. The power components 306 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 300.
The multimedia component 308 comprises a screen providing an output interface between the electronic device 300 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 308 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 300 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 310 is configured to output and/or input audio signals. For example, the audio component 310 includes a Microphone (MIC) configured to receive an external audio signal when the electronic device 300 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 304 or transmitted via the communication component 316. In some embodiments, audio component 310 also includes a speaker for outputting audio signals.
The I/O interface 312 provides an interface between the processing component 302 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
Sensor assembly 314 includes one or more sensors for providing various aspects of status assessment for electronic device 300. For example, sensor assembly 314 may detect an open/closed state of electronic device 300, the relative positioning of components, such as a display and keypad of electronic device 300, sensor assembly 314 may also detect a change in the position of electronic device 300 or components of electronic device 300, the presence or absence of user contact with electronic device 300, the orientation or acceleration/deceleration of device 300, and a change in the temperature of electronic device 300. Sensor assembly 314 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 314 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 316 is configured to facilitate wired or wireless communication between the electronic device 300 and other devices. The electronic device 300 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 300 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 304 comprising instructions, executable by the processor 320 of the electronic device 300 to perform the above-described method is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, which includes instructions executable by the processor 320 of the electronic device 300 to perform the above-described method.
It should be noted that the descriptions of the above-mentioned apparatus, the electronic device, the computer-readable storage medium, the computer program product, and the like according to the method embodiments may also include other embodiments, and specific implementations may refer to the descriptions of the related method embodiments, which are not described in detail herein.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A single-page version updating method is characterized by comprising the following steps:
receiving a website version update message sent by a working thread through a main thread of a browser tag page, wherein the working thread is used for detecting the update of the website version;
and responding to the message, and switching the currently displayed tag page to a new version tag page by the main thread.
2. The method of claim 1, wherein the main thread switching a currently exposed tab page to a new version of a tab page in response to the message comprises:
in response to the message, the main thread marks the currently displayed tag page as a state to be updated;
and responding to a switching instruction of the tag page, and switching the tag page in the state to be updated to a new version of tag page.
3. The method of claim 2, wherein the switching the tab page in the state to be updated to the new version tab page in response to the switching instruction of the tab page comprises:
in response to a switching instruction of a tag page, intercepting a default access path to be jumped by the tag page in the state to be updated;
and acquiring an access path corresponding to the new version of the tag page, and replacing the default access path with the access path to switch to the new version of the tag page.
4. The method of claim 1, wherein the main thread switching a currently exposed tab page to a new version of a tab page in response to the message comprises:
in response to the message, the main thread presents a prompt for a website version update;
and responding to a trigger instruction generated by a user selecting an updated version according to the prompt, and switching the currently displayed tag page to a new version tag page by the main thread.
5. The method according to claim 1, wherein the worker thread is further configured to send the updated message to a plurality of main threads corresponding to a plurality of tab pages of the browser, respectively, and before the receiving, by the main thread of the tab page of the browser, the message of the website version update sent by the worker thread, further includes:
when the label page is jumped to, detecting whether to start a working thread of version updating or not through a main thread corresponding to the label page;
and if the working thread is started, the main thread is connected with the working thread to receive the message sent by the working thread.
6. The method of claim 1, wherein the worker thread is further configured to
After detecting that the website version is updated, sending a hypertext transmission request to a website server;
receiving a hypertext markup language file returned by the website server;
analyzing the hypertext markup language file to obtain a plurality of scripts and static file resources corresponding to the preloaded links;
the main thread switches the currently displayed tag page to a new version tag page, and the method comprises the following steps:
and the main thread switches the currently displayed label page to a new version label page according to the scripts and the static file resources.
7. A single-page version-updating apparatus, comprising:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a website version updating message sent by a working thread through a main thread of a browser tag page, and the working thread is used for detecting the updating of the website version;
and the switching module is used for responding to the message, and the main thread switches the currently displayed tag page to a new version of tag page.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the single-page version update method of any one of claims 1 to 6.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the single-page version update method of any of claims 1 to 6.
10. A computer program product comprising instructions therein, which when executed by a processor of an electronic device, enable the electronic device to perform the single page version update method of any one of claims 1 to 6.
CN202111534113.6A 2021-12-15 2021-12-15 Single-page version updating method and device, electronic equipment and storage medium Pending CN114238813A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111534113.6A CN114238813A (en) 2021-12-15 2021-12-15 Single-page version updating method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111534113.6A CN114238813A (en) 2021-12-15 2021-12-15 Single-page version updating method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114238813A true CN114238813A (en) 2022-03-25

Family

ID=80756321

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111534113.6A Pending CN114238813A (en) 2021-12-15 2021-12-15 Single-page version updating method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114238813A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033778A (en) * 2010-12-16 2011-04-27 电子科技大学 Thread processing method for control, analysis and composition of embedded browser
CN107783770A (en) * 2017-08-25 2018-03-09 上海壹账通金融科技有限公司 Page configuration update method, device, server and medium
CN109933349A (en) * 2019-01-28 2019-06-25 优信拍(北京)信息科技有限公司 A kind of method to be timely updated based on vue spa, system and equipment
CN110781009A (en) * 2018-07-30 2020-02-11 北京京东尚科信息技术有限公司 Method and device for real-time communication of browser page

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033778A (en) * 2010-12-16 2011-04-27 电子科技大学 Thread processing method for control, analysis and composition of embedded browser
CN107783770A (en) * 2017-08-25 2018-03-09 上海壹账通金融科技有限公司 Page configuration update method, device, server and medium
CN110781009A (en) * 2018-07-30 2020-02-11 北京京东尚科信息技术有限公司 Method and device for real-time communication of browser page
CN109933349A (en) * 2019-01-28 2019-06-25 优信拍(北京)信息科技有限公司 A kind of method to be timely updated based on vue spa, system and equipment

Similar Documents

Publication Publication Date Title
CN107329743B (en) Application page display method and device and storage medium
CN109032606B (en) Native application compiling method and device and terminal
US11704001B2 (en) Method and device for displaying web page content
CN111273899B (en) Code processing method, device, electronic equipment and storage medium
CN107229711B (en) Webpage display method and device
CN105930536B (en) Index establishing method, page jumping method and device
CN105786944B (en) Method and device for processing automatic page turning of browser
CN111639276A (en) Resource preloading method and device and storage medium
US11210449B2 (en) Page display method and device and storage medium
CN110413169B (en) Information display method, device and medium
CN106708967B (en) Page display method and device
CN112733058B (en) Data processing system, method, device, electronic equipment and storage medium
CN111338961B (en) Application debugging method and device, electronic equipment and storage medium
CN110543265A (en) Page title bar generation method and device, electronic equipment and storage medium
CN113238881A (en) Page communication method and device
CN115373763B (en) Plug-in loading method and device, electronic equipment and storage medium
CN111079040A (en) Resource sniffing method, device, terminal, server and storage medium
CN113486281B (en) Page display method and device, electronic equipment and storage medium
CN115119038B (en) Information display method and device, electronic equipment and storage medium
CN105630948A (en) Web page display method and apparatus
CN114238813A (en) Single-page version updating method and device, electronic equipment and storage medium
CN105868354B (en) Webpage repairing method and device
CN107948425A (en) Footmark methods of exhibiting and device
CN111131000A (en) Information transmission method, device, server and terminal
CN110659253A (en) File packaging method and device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination