CN116304458B - Method, device, equipment and medium for web page real-time notification update - Google Patents

Method, device, equipment and medium for web page real-time notification update Download PDF

Info

Publication number
CN116304458B
CN116304458B CN202310170694.2A CN202310170694A CN116304458B CN 116304458 B CN116304458 B CN 116304458B CN 202310170694 A CN202310170694 A CN 202310170694A CN 116304458 B CN116304458 B CN 116304458B
Authority
CN
China
Prior art keywords
web page
function
file
html content
time stamp
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.)
Active
Application number
CN202310170694.2A
Other languages
Chinese (zh)
Other versions
CN116304458A (en
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.)
Shanghai Hard Link Network Technology Co ltd
Original Assignee
Shanghai Hard Link Network 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 Shanghai Hard Link Network Technology Co ltd filed Critical Shanghai Hard Link Network Technology Co ltd
Priority to CN202310170694.2A priority Critical patent/CN116304458B/en
Publication of CN116304458A publication Critical patent/CN116304458A/en
Application granted granted Critical
Publication of CN116304458B publication Critical patent/CN116304458B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to the technical field of computers, in particular to a web page real-time notification updating method, device, equipment and medium, wherein the method specifically comprises the following steps: packaging a web page based on a packaging tool, packaging a JavaScript file set into a first JavaScript file at the same time, and setting a file fingerprint for the file name of the first JavaScript file; accessing and analyzing a first HTML content of the web page, and acquiring a first array according to script tag content of the first HTML content; setting a time stamp function, accessing and analyzing second HTML content of an update server page, acquiring a second array according to script tag content of the second HTML content, and starting a timer to poll; and determining that the contents of the first array and the second array are different, and updating the web page. The invention detects whether the page is changed in real time, and immediately informs a player to refresh the page to acquire the latest version function after detecting that the page is changed.

Description

Method, device, equipment and medium for web page real-time notification update
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for web page real-time notification update.
Background
With the development of web front-end technology, javaScript language is widely used in web front-end development. However, when the user still stays at the old page after the version of the web front-end page is updated and released, the user does not know that the web page is redeployed, so that the user cannot experience the latest function in time after continuing to use the old version, and therefore a scheme for detecting whether the HTML page is changed in real time is needed.
Disclosure of Invention
The invention aims to provide a method, a device, equipment and a medium for web page real-time notification update, which are used for detecting whether a page is changed in real time, and immediately notifying a player to refresh the page to acquire the latest version function after detecting that the page is changed so as to solve at least one of the problems in the prior art.
In one aspect, the invention provides a web page real-time notification updating method, which specifically comprises the following steps:
packaging a web page based on a packaging tool, packaging a JavaScript file set into a first JavaScript file at the same time, and setting a file fingerprint for the file name of the first JavaScript file;
accessing and analyzing a first HTML content of the web page, and acquiring a first array according to script tag content of the first HTML content;
setting a time stamp function, accessing and analyzing second HTML content of an update server page, acquiring a second array according to script tag content of the second HTML content, and starting a timer to poll;
and determining that the contents of the first array and the second array are different, and updating the web page.
Further, the setting a file fingerprint for the file name of the first JavaScript file specifically includes:
determining a first storage path and a second storage path, wherein the first storage path is a storage path of the JavaScript file set, and the second storage path is an output path of the first JavaScript file;
setting a file fingerprint for the file name of the first JavaScript file;
intercepting a plurality of bit characters of a file name of the first JavaScript file according to the file fingerprint and generating a hash value;
and creating a key value pair index table, and storing the hash value into the key value pair index table.
Further, the accessing and parsing the first HTML content of the web page specifically includes:
obtaining a first interface according to a fetch function, and accessing first HTML content of a web page through the first interface;
and analyzing the first HTML content according to the regular expression.
Further, the setting the timestamp function specifically includes:
setting a time stamp function, determining the time stamp function as a date. Gettime function, and generating a first time stamp according to the date. Gettime function;
or setting a time stamp function, determining the time stamp function as a date. Now function, and generating a second time stamp according to the date. Now function;
or setting a time stamp function, determining the time stamp function as a date.parameter function, and generating a third time stamp according to the date.parameter function;
or setting a time stamp function, determining the time stamp function as a date.UTC function, and generating a fourth time stamp according to the date.UTC function.
Further, the accessing and analyzing the second HTML content of the update server page specifically includes:
obtaining a second interface according to the fetch function, and accessing a second HTML content of the update server page through the second interface;
and analyzing the second HTML content according to the regular expression.
Further, the starting the timer to poll specifically includes:
setting a timer according to the setInterval function;
and polling is carried out every preset seconds according to the timer setting.
Further, the updating the web page specifically includes:
sending a refresh notification to the web page;
when the web page generates and sends a refresh command according to the refresh notification, responding to the refresh command, and obtaining the second HTML content from the update server page according to a window.location.reload (true) function;
the first HTML content of the web page is replaced with the second HTML content.
On the other hand, the invention also provides a web page real-time notification updating device, which specifically comprises:
the packaging module is used for packaging the web page based on the packaging tool, packaging the JavaScript file set into a first JavaScript file, and setting file fingerprints for file names of the first JavaScript file;
the first processing module is used for accessing and analyzing the first HTML content of the web page and acquiring a first array according to the script tag content of the first HTML content;
the second processing module is used for setting a time stamp function, accessing and analyzing second HTML (hypertext markup language) contents of the update server page, acquiring a second array according to script tag contents of the second HTML contents, and starting a timer to poll;
and the updating module is used for judging that the contents of the first array and the second array are different and updating the web page.
In another aspect, the present invention also provides a computer device, including: memory and processor and computer program stored on the memory, which when executed on the processor, implements the web page real-time notification update method according to any of claims 1 to 7.
In another aspect, the present invention also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a web page real-time notification update method as claimed in any of claims 1 to 7.
Compared with the prior art, the invention has at least one of the following technical effects:
1. the user can receive the update notification of the latest page without manually refreshing the page, so that the user can refresh the page more timely to experience new functions.
2. Detecting whether the page is changed or not in real time, and notifying a player to refresh the page to acquire the latest version function after detecting that the page is changed.
3. After refreshing the page, the user can obtain the latest version of HTML page content.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an implementation environment of a web page real-time notification update method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for updating web page real-time notification according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a real-time web page notification update apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
With the development of web front-end technology, javaScript language is widely used in web front-end development. However, when the user still stays at the old page after the version of the web front-end page is updated and released, the user does not know that the web page is redeployed, so that the user cannot experience the latest function in time after continuing to use the old version, and therefore a scheme for detecting whether the HTML page is changed in real time is needed.
Fig. 1 is a schematic diagram of an implementation environment of a web page real-time notification update method according to an embodiment of the present invention. Referring to fig. 1, the software and hardware main body of the implementation environment mainly includes a programmed computer 101, an update server 102, and a terminal device 103. In this embodiment, the programmed computer 101 is configured to write and package new web pages and upload to the update server 102, and the terminal device 103 is configured to allow the user to browse the web pages, obtain the latest web pages from the update server 102, and replace the original web pages.
Specifically, the terminal device 103 in the embodiment of the present invention may include, but is not limited to, any one or more of a smart watch, a smart phone, a tablet computer, a desktop computer, a personal digital assistant (Personal Digital Assistant, PDA), a smart home appliance, or a vehicle-mounted device. The update server 102 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligence platforms, and the like.
Communication connections between the programmed computer 101 and the update server 102, and between the update server 102 and the terminal device 103 are established primarily through a wireless network using standard communication techniques and/or protocols, which may be provided as the internet, as well as any other network, including, but not limited to, a local area network (Local Area Network, LAN), metropolitan area network (Metropolitan Area Network, MAN), wide area network (Wide Area Network, WAN), mobile, wired or wireless network, a private network, or any combination of virtual private networks, for example.
Referring to fig. 2, fig. 2 is a flowchart of a web page real-time notification update method provided by an embodiment of the present invention, and the present invention provides a web page real-time notification update method, where the method specifically includes:
s201: and packaging the web page based on a packaging tool, packaging the JavaScript file set into a first JavaScript file, and setting a file fingerprint for the file name of the first JavaScript file.
In some embodiments, the setting a file fingerprint for the file name of the first JavaScript file specifically includes:
determining a first storage path and a second storage path, wherein the first storage path is a storage path of the JavaScript file set, and the second storage path is an output path of the first JavaScript file;
setting a file fingerprint for the file name of the first JavaScript file;
intercepting a plurality of bit characters of a file name of the first JavaScript file according to the file fingerprint and generating a hash value;
and creating a key value pair index table, and storing the hash value into the key value pair index table.
In this embodiment, the packaging tool weback may be used to package some language files including JavaScript files that cannot be directly run by the web browser, and convert the language files into a format that can be directly run by the web browser. The JavaScript file can be called by the HTML page of the web browser through the script tag, javaScript codes can be directly embedded in the script tag, and external JavaScript files can be introduced through the src attribute of the script tag.
In addition, in order to solve the problem of excessive requests of the JavaScript scripts of the web page, the JavaScript file set is packed into the first JavaScript file, so that the loading performance of the web page is improved. In the packing process, a hash file fingerprint strategy is adopted for the JavaScript file, and the hash value constructed by the whole project can be changed as long as the project file is modified.
Setting the file fingerprint statement as filename: '[ name ] _ [ hash:8]. Js' for the file name of the first JavaScript file, and generating a unique hash value by intercepting the first eight characters of the file name of the first JavaScript file, so that when the web page code is changed, the file fingerprint hash can be changed, and the file name of the main entry JavaScript file introduced by the web page which is redeployed each time is different.
S202: and accessing and analyzing the first HTML content of the web page, and acquiring a first array according to the script tag content of the first HTML content.
In some embodiments, the accessing and parsing the first HTML content of the web page specifically includes:
obtaining a first interface according to a fetch function, and accessing first HTML content of a web page through the first interface;
and analyzing the first HTML content according to the regular expression.
In this embodiment, the fetch is a function of JavaScript language, which may provide a JavaScript interface for issuing an http request to a web page, with the statement being
fetch(URL)
then(function(response){return response.json()})
then(function(myJson){console.log(myJson)});
The URL refers to the address of a standard resource on the Internet, and each file has a unique URL, so that after the URL of the first HTML content is input, an access request can be initiated to the first HTML content. Then, the source code of the first HTML content is analyzed by using the regular expression to obtain a first array, wherein the first array is script tag content extracted from the source code of the first HTML content through the regular expression.
S203: and setting a time stamp function, accessing and analyzing second HTML content of the update server page, acquiring a second array according to script tag content of the second HTML content, and starting a timer to poll.
In some embodiments, the setting a timestamp function specifically includes:
setting a time stamp function, determining the time stamp function as a date. Gettime function, and generating a first time stamp according to the date. Gettime function;
or setting a time stamp function, determining the time stamp function as a date. Now function, and generating a second time stamp according to the date. Now function;
or setting a time stamp function, determining the time stamp function as a date.parameter function, and generating a third time stamp according to the date.parameter function;
or setting a time stamp function, determining the time stamp function as a date.UTC function, and generating a fourth time stamp according to the date.UTC function.
The accessing and analyzing the second HTML content of the update server page specifically includes:
obtaining a second interface according to the fetch function, and accessing a second HTML content of the update server page through the second interface;
and analyzing the second HTML content according to the regular expression.
The starting timer performs polling, which specifically includes:
setting a timer according to the setInterval function;
and polling is carried out every preset seconds according to the timer setting.
In this embodiment, the Date function in JavaScript language is used to generate timestamp information for marking each time an access is initiated to the second HTML content of the update server page.
Setting a time stamp function, wherein the time stamp function can be determined as a date.gettime function or a date.now function or a date.parameter function or a date.UTC function, and a statement for generating a first time stamp according to the date.gettime function is
var DateNow=new Date();
console.log(moonLanding.getTime());
Generating a second timestamp statement as a function of date. Now
var DateNow=Date.now();
console.log(DateNow);
Generating a statement of the third timestamp according to the date. Parameter function as
const DateNow=Date.parse();
console.log(DateNow);
Generating a statement of a fourth timestamp according to the date. UTC function as
const DateNow=new Date(Date.UTC());
console.log(DateNow.oUTCString);
And accessing a second HTML content of the update server page through the fetch function, analyzing through the regular expression, and obtaining a second array, wherein the second array is script tag content extracted from source codes of the second HTML content through the regular expression. And the function is input into the setInterval function, the function is called at regular time through the setInterval function, and the infinite loop is executed, so that the effect of continuously acquiring the latest second HTML content through polling is achieved.
S204: and determining that the contents of the first array and the second array are different, and updating the web page.
In some embodiments, the updating the web page specifically includes:
sending a refresh notification to the web page;
when the web page generates and sends a refresh command according to the refresh notification, responding to the refresh command, and obtaining the second HTML content from the update server page according to a window.location.reload (true) function;
the first HTML content of the web page is replaced with the second HTML content.
In this embodiment, whether the first array and the second array are identical is determined through the set, if the contents of the first array and the second array are different, it is determined that the second HTML content of the update server page belongs to the latest version, so that a refresh notification is sent to a user browsing the web page, whether to refresh the web page is queried, the refresh notification is presented in the form of a reminder frame, and the reminder frame has an "agree" button. In connection with fig. 1, a user may browse web pages on a web browser through the terminal device 103, a programmer programs and packages new pages (i.e., server pages) by programming the computer 101 and uploads the new pages to the update server 102, and when the user receives a refresh notification through the terminal device 103 and clicks on the refresh, the terminal device 103 skips the cache of the web browser and obtains the server pages from the update server 102.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a web page real-time notification updating device 3 according to an embodiment of the present invention, and the present invention provides a web page real-time notification updating device, where the device 3 specifically includes:
the packaging module 301 is configured to package a web page based on a packaging tool, meanwhile package a JavaScript file set into a first JavaScript file, and set a file fingerprint for a file name of the first JavaScript file; the first processing module 302 is configured to access and parse a first HTML content of the web page, and obtain a first array according to a script tag content of the first HTML content; a second processing module 303, configured to set a timestamp function, access and analyze a second HTML content of an update server page, obtain a second array according to script tag content of the second HTML content, and start a timer to perform polling; and the updating module 304 is configured to determine that the contents of the first array and the second array are different, and update the web page.
It can be understood that the content in the embodiment of the web page real-time notification updating method shown in fig. 2 is applicable to the embodiment of the web page real-time notification updating device, and the functions of the embodiment of the web page real-time notification updating device are the same as those of the embodiment of the web page real-time notification updating method shown in fig. 2, and the beneficial effects achieved by the embodiment of the web page real-time notification updating method shown in fig. 2 are the same as those achieved by the embodiment of the web page real-time notification updating method shown in fig. 2.
It should be noted that, because the content of information interaction and execution process between the above devices is based on the same concept as the method embodiment of the present invention, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Referring to fig. 4, the present invention provides a computer device 4 comprising: memory 402 and processor 401 and a computer program 403 stored on the memory 402, which computer program 403, when executed on the processor 401, implements a web page real-time notification update method according to any of the above methods.
The computer device 4 may be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The computer device may include, but is not limited to, a processor 401, a memory 402. It will be appreciated by those skilled in the art that fig. 4 is merely an example of computer device 4 and is not intended to limit computer device 4, and may include more or fewer components than shown, or may combine certain components, or may include different components, such as input-output devices, network access devices, etc.
The processor 401 may be a central processing unit (Central Processing Unit, CPU), but the processor 401 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 402 may in some embodiments be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. The memory 402 may also be an external storage device of the computer device 4 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the computer device 4. Further, the memory 402 may also include both internal storage units and external storage devices of the computer device 4. The memory 402 is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs, such as program code for the computer program. The memory 402 may also be used to temporarily store data that has been output or is to be output.
The invention also provides a computer-readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, implements a web page real-time notification update method according to any of the above methods.
In this embodiment, the integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (RAM, random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments disclosed in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

Claims (10)

1. The web page real-time notification updating method is characterized by comprising the following steps of:
packaging a web page based on a packaging tool, packaging a JavaScript file set into a first JavaScript file at the same time, and setting a file fingerprint for the file name of the first JavaScript file; the file fingerprint is used for identifying whether the web page is updated;
accessing and analyzing a first HTML content of the web page, and acquiring a first array according to script tag content of the first HTML content; the script tag content is used for calling a JavaScript file or embedding a JavaScript code;
setting a time stamp function, accessing and analyzing second HTML content of an update server page, acquiring a second array according to script tag content of the second HTML content, and starting a timer to poll so as to keep the second array up to date; the time stamp is used for marking the time of each initiation of access to the second HTML content of the update server page;
and determining that the contents of the first array and the second array are different, and updating the web page.
2. The method of claim 1, wherein the setting a file fingerprint for a file name of the first JavaScript file specifically comprises:
determining a first storage path and a second storage path, wherein the first storage path is a storage path of the JavaScript file set, and the second storage path is an output path of the first JavaScript file;
setting a file fingerprint for the file name of the first JavaScript file;
intercepting a plurality of bit characters of a file name of the first JavaScript file according to the file fingerprint and generating a hash value;
and creating a key value pair index table, and storing the hash value into the key value pair index table.
3. The method according to claim 1, characterized in that said accessing and parsing the first HTML content of said web page comprises in particular:
obtaining a first interface according to a fetch function, and accessing first HTML content of a web page through the first interface;
and analyzing the first HTML content according to the regular expression.
4. The method according to claim 1, characterized in that said setting a time stamp function comprises in particular: setting a time stamp function, determining the time stamp function as a date. Gettime function, and generating a first time stamp according to the date. Gettime function;
or setting a time stamp function, determining the time stamp function as a date. Now function, and generating a second time stamp according to the date. Now function;
or setting a time stamp function, determining the time stamp function as a date.parameter function, and generating a third time stamp according to the date.parameter function;
or setting a time stamp function, determining the time stamp function as a date.UTC function, and generating a fourth time stamp according to the date.UTC function.
5. The method according to claim 1, wherein the accessing and parsing the second HTML content of the update server page comprises:
obtaining a second interface according to the fetch function, and accessing a second HTML content of the update server page through the second interface;
and analyzing the second HTML content according to the regular expression.
6. The method according to claim 1, wherein the starting the timer performs polling, specifically comprising:
setting a timer according to the setInterval function;
and polling is carried out every preset seconds according to the timer setting.
7. The method according to claim 1, characterized in that said updating said web page comprises in particular:
sending a refresh notification to the web page;
when the web page generates and sends a refresh command according to the refresh notification, responding to the refresh command, and obtaining the second HTML content from the update server page according to a window.location.reload (true) function;
the first HTML content of the web page is replaced with the second HTML content.
8. A web page real-time notification update apparatus, the apparatus specifically comprising:
the packaging module is used for packaging the web page based on the packaging tool, packaging the JavaScript file set into a first JavaScript file, and setting file fingerprints for file names of the first JavaScript file;
the file fingerprint is used for identifying whether the web page is updated;
the first processing module is used for accessing and analyzing the first HTML content of the web page and acquiring a first array according to the script tag content of the first HTML content; the script tag content is used for calling a JavaScript file or embedding a JavaScript code;
the second processing module is used for setting a time stamp function, accessing and analyzing second HTML content of the update server page, acquiring a second array according to script tag content of the second HTML content, and starting a timer to poll so as to keep the second array up to date; the time stamp is used for marking the time of each initiation of access to the second HTML content of the update server page;
and the updating module is used for judging that the contents of the first array and the second array are different and updating the web page.
9. A computer device, comprising: memory and processor and computer program stored on the memory, which when executed on the processor, implements the web page real-time notification update method according to any of claims 1 to 7.
10. A computer readable storage medium, having stored thereon a computer program which, when executed by a processor, implements the web page real-time notification update method of any of claims 1 to 7.
CN202310170694.2A 2023-02-27 2023-02-27 Method, device, equipment and medium for web page real-time notification update Active CN116304458B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310170694.2A CN116304458B (en) 2023-02-27 2023-02-27 Method, device, equipment and medium for web page real-time notification update

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310170694.2A CN116304458B (en) 2023-02-27 2023-02-27 Method, device, equipment and medium for web page real-time notification update

Publications (2)

Publication Number Publication Date
CN116304458A CN116304458A (en) 2023-06-23
CN116304458B true CN116304458B (en) 2024-04-16

Family

ID=86837198

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310170694.2A Active CN116304458B (en) 2023-02-27 2023-02-27 Method, device, equipment and medium for web page real-time notification update

Country Status (1)

Country Link
CN (1) CN116304458B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103279373A (en) * 2013-05-31 2013-09-04 广州市动景计算机科技有限公司 Method and device for updating browser shell functions
CN103714078A (en) * 2012-09-29 2014-04-09 百度在线网络技术(北京)有限公司 Method, system and device for providing update contents of web pages
CN107678820A (en) * 2017-09-29 2018-02-09 北京金山安全软件有限公司 Webpage processing method, device, server, terminal equipment and medium
CN110442815A (en) * 2019-06-24 2019-11-12 北京奇艺世纪科技有限公司 Page generation method, system, device and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7698321B2 (en) * 2005-09-30 2010-04-13 At&T Intellectual Property I, L.P. Methods, systems, and products for updating web content

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103714078A (en) * 2012-09-29 2014-04-09 百度在线网络技术(北京)有限公司 Method, system and device for providing update contents of web pages
CN103279373A (en) * 2013-05-31 2013-09-04 广州市动景计算机科技有限公司 Method and device for updating browser shell functions
CN107678820A (en) * 2017-09-29 2018-02-09 北京金山安全软件有限公司 Webpage processing method, device, server, terminal equipment and medium
CN110442815A (en) * 2019-06-24 2019-11-12 北京奇艺世纪科技有限公司 Page generation method, system, device and computer readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JSP静态网页生成技术的研究;徐白;宋玲;吴昊;;计算机技术与发展;20100610(第06期);全文 *
Object oriented programming in JavaScript;Sklenar, J.;Proceedings of the 26th ASU Conference Object Oriented Modeling and Simulation;20000101;35-42 *

Also Published As

Publication number Publication date
CN116304458A (en) 2023-06-23

Similar Documents

Publication Publication Date Title
CN107729352B (en) Page resource loading method and terminal equipment
US9215246B2 (en) Website scanning device and method
CN111414407A (en) Data query method and device of database, computer equipment and storage medium
US20150033331A1 (en) System and method for webpage analysis
CN110245069B (en) Page version testing method and device and page display method and device
CN111008348A (en) Anti-crawler method, terminal, server and computer readable storage medium
CN111737692B (en) Application program risk detection method and device, equipment and storage medium
WO2019076014A1 (en) Webpage generation method and apparatus, terminal device and medium
US11354363B2 (en) Apparatus and method for calling a function in a database with a URL
CN112637361B (en) Page proxy method, device, electronic equipment and storage medium
US20130047073A1 (en) Web content management based on timeliness metadata
CN105678127A (en) Verification method and device for identity information
CN113469866A (en) Data processing method and device and server
US11062019B2 (en) System and method for webpages scripts validation
CN112069384A (en) Buried point data processing method, server and readable storage medium
CN109670100B (en) Page data capturing method and device
CN109325192B (en) Advertisement anti-shielding method and device
CN113330432A (en) Asynchronous predictive caching of content listed in search results
CN113343312A (en) Page tamper-proofing method and system based on front-end point burying technology
CN109150842B (en) Injection vulnerability detection method and device
CN116304458B (en) Method, device, equipment and medium for web page real-time notification update
CN112130944A (en) Page abnormity detection method, device, equipment and storage medium
CN111782244A (en) Configuration file updating method and device, computer equipment and storage medium
CN111177600A (en) Built-in webpage loading method and device based on mobile application
US20190014130A1 (en) Detecting safe internet resources

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
GR01 Patent grant
GR01 Patent grant