A method, device, medium and electronic device for loading static web page resources
By moving and signing static web resource files, it solves the problem of mismatched loading of static resources on HTML pages, realizes version management and selective loading of resource files, and improves the loading speed and user experience of mobile apps.
Patent Information
- Application Number
- CN201810691210.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-06-28
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2038-06-28
AI Technical Summary
In the existing technology, static resource loading of HTML pages in mobile apps has resource file mismatch problems, resulting in waste of bandwidth and low performance, and the update status of static resources cannot be effectively sensed, resulting in abnormal user experience.
Reduce network requests by moving files in the static web resource directory to different directories, adding signature information to image file names, updating reference relationships, cleaning up unnecessary file versions, ensuring resource files match and selectively loading the latest version.
It realizes the matching of HTML and resource files, supports different versions of HTML to load correct resources, reduces network requests, and improves loading speed and user experience.
Smart Images

Figure CN110727889B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, medium and electronic device for loading static web page resources. Background Art
[0002] At present, there is an increasing demand for embedding HTML5 in mobile apps, and therefore, there are higher requirements for the rendering speed and user experience of HTML5 pages.
[0003] In the existing technical solutions, the main way to reference static resources in HTML pages is to uniformly append a timestamp after the URL of static resources such as JS and CSS to achieve real-time reference of newly released resource files.
[0004] However, this technical solution has the following disadvantages:
[0005] (1) When resource files are published, the timestamps of all resource files will be updated in batches. Even files that have not been modified will need to be reloaded on the HTML page due to the update of the timestamps, resulting in a waste of bandwidth.
[0006] (2) The timestamp method can effectively prompt the browser to use the cache or read the static resources of the server, but the resource server cannot perceive that the request for the static resource file comes from the newly effective HTML or the HTML page that has not been updated yet; in the gap between the release of the front-end HTML code and the release of the static resource file, there is a chance that the HTML code and the static resource file will not match: for example, when the user visits the HTML page, the HTML code has been loaded, and when requesting the JS code, the new resource file happens to take effect on the server. At this time, the old HTML page loads the new JS and other codes, which will cause display or functional abnormalities.
[0007] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0008] The purpose of the embodiments of the present invention is to provide a method, device, medium and electronic device for loading static web page resources, thereby overcoming one or more problems such as easy errors and low performance in updating static HTML pages caused by limitations and defects of related technologies at least to a certain extent.
[0009] Other features and advantages of the embodiments of the present invention will become apparent from the following detailed description, or may be learned in part by the practice of the present invention.
[0010] According to a first aspect of an embodiment of the present invention, a method for loading a static webpage resource is provided, characterized by comprising:
[0011] Move the first file and the second file in the static webpage resource directory to the first directory;
[0012] Add signature information to the file name of the image file in the static webpage resource file directory and move it to the second directory;
[0013] Based on the file names of the picture files in the second directory, updating the reference relationship between the referenced picture files of the first file and the second file in the first directory;
[0014] Based on the updated first and second files in the first directory, updating the third file in the static webpage resource directory;
[0015] The updated third file, the first directory and the second directory are packaged to achieve loading of static web page resources.
[0016] According to an embodiment of the present invention, based on the above scheme, after adding signature information to the file name of the image file in the static webpage resource file directory and moving it to the second directory, the method further includes:
[0017] When it is detected that a new picture file is added to the second directory, the picture files with the same file name in the second directory are cleaned up, and a preset number of picture files within a preset time period are retained.
[0018] According to an embodiment of the present invention, based on the above-mentioned solution, the updating of the reference relationship between the referenced picture files of the first file and the second file in the first directory based on the file names of the picture files in the second directory includes:
[0019] Traversing the first file and the second file in the first directory to determine a reference relationship between the first file and the second file referring to the image file;
[0020] Replace the file name of the first file in the first directory and the reference relationship between the second file with the file name of the picture file referenced in the second directory;
[0021] Signature information is added to the file name of the first file and the file name of the second file after the file name is replaced.
[0022] According to an embodiment of the present invention, based on the above solution, after the reference relationship between the referenced image files of the first file and the second file in the first directory is updated, the method further includes:
[0023] The files with the same file name in the updated second directory are cleaned up, and a preset number of first files and second files within a preset time period are retained.
[0024] According to an embodiment of the present invention, based on the above solution, the updating of the third file under the static webpage resource directory based on the updated first file and second file in the first directory includes:
[0025] The reference relationship between the first file and the second file referenced by the third file in the static webpage resource directory is updated to reference the first file and the second file in the first directory.
[0026] According to a second aspect of an embodiment of the present invention, a static webpage resource loading device is provided, comprising: a first moving module, a second moving module, a first updating module, a second updating module, and a packaging module; wherein:
[0027] A first moving module, used to move the first file and the second file in the static webpage resource directory to the first directory;
[0028] A second moving module, used to add signature information to the file name of the image file in the static webpage resource file directory and move it to the second directory;
[0029] A first updating module, configured to update a reference relationship between a first file and a second file in the first directory and a referenced image file based on the file name of the image file in the second directory;
[0030] A second updating module, configured to update a third file in the static webpage resource directory based on the updated first file and second file in the first directory;
[0031] The packaging module is used to package the updated third file, the first directory and the second directory to realize the loading of static web page resources.
[0032] According to one embodiment of the present invention, based on the above solution, the above device further includes:
[0033] The first cleaning module is used to clean up the image files with the same file name in the second directory when it is detected that a new image file is added to the second directory, and retain a preset number of image files within a preset time period.
[0034] According to one embodiment of the present invention, based on the above solution, the first update module is specifically used for:
[0035] Traversing the first file and the second file in the first directory to determine a reference relationship between the first file and the second file referring to the image file;
[0036] Replace the file name of the first file in the first directory and the reference relationship between the second file with the file name of the picture file referenced in the second directory;
[0037] Signature information is added to the file name of the first file and the file name of the second file after the file name is replaced.
[0038] According to one embodiment of the present invention, based on the above solution, the above device further includes:
[0039] The second cleaning module is used to clean up the files with the same file name in the updated second directory, and retain a preset number of first files and second files within a preset time period.
[0040] According to one embodiment of the present invention, based on the above solution, the second update module is specifically used for:
[0041] The reference relationship between the first file and the second file referenced by the third file in the static webpage resource directory is updated to reference the first file and the second file in the first directory.
[0042] According to a third aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for loading static web page resources according to the first aspect of the above embodiment is implemented.
[0043] According to a fourth aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a method for loading static web page resources as in the first aspect of the above-mentioned embodiment.
[0044] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0045] In the technical solutions provided by some embodiments of the present invention, the first file and the second file in the static web page resource directory are moved to the first directory; the signature information is added to the file name of the image file in the static web page resource file directory and moved to the second directory; based on the file name of the image file in the second directory, the reference relationship of the referenced image file of the first file and the second file in the first directory is updated; based on the updated first file and second file in the first directory, the third file in the static web page resource directory is updated; the updated third file, the first directory and the second directory are packaged to realize the loading of static web page resources. In this way, the technical solution of the embodiment of the present invention can match HTML with the corresponding resource file, and the resource server retains the latest versions of resource files to ensure that different versions of HTML can be loaded into the correct resource file at the same time. At the same time, it can also reduce network requests by selectively loading the recently modified resource files, effectively improve the loading speed, and increase a better service experience.
[0046] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The drawings herein are incorporated into and constitute a part of the specification, showing embodiments consistent with the present invention, and together with the specification, are used to explain the principles of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0048] Figure 1 The schematic diagram of the principle of the existing webpage anti-tampering technology is shown;
[0049] Figure 2 Schematically shows a flow chart of a method for verifying client terminal data according to an embodiment of the present invention;
[0050] Figure 3 A flowchart schematically shows a method for verifying data on a server terminal according to an embodiment of the present invention;
[0051] Figure 4 The structure diagram of the computer system of the electronic device according to one embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0052] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present invention will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0053] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solution of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.
[0054] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0055] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0056] Figure 1 The flowchart of a method for loading static web page resources according to an embodiment of the present invention is schematically shown.
[0057] Reference Figure 1 As shown, a method for loading static web page resources according to an embodiment of the present invention includes the following steps:
[0058] Step S110, moving the first file and the second file in the static webpage resource directory to the first directory;
[0059] Step S120, adding signature information to the file name of the image file in the static webpage resource file directory and moving it to the second directory;
[0060] Step S130, based on the file names of the picture files in the second directory, updating the reference relationship between the referenced picture files of the first file and the second file in the first directory;
[0061] Step S140, updating the third file in the static webpage resource directory based on the updated first file and second file in the first directory;
[0062] Step S150, packaging the updated third file, the first directory and the second directory to achieve loading of static web page resources.
[0063] Figure 1 The technical solution of the illustrated embodiment can match HTML with the corresponding resource files. The resource server retains the latest versions of resource files to ensure that different versions of HTML can be loaded into the correct resource files at the same time. At the same time, it can also selectively load the most recently modified resource files to reduce network requests, effectively improve loading speed, and provide a better service experience.
[0064] The following Figure 1 The implementation details of each step shown in are elaborated in detail:
[0065] In step S110, the first file and the second file in the static webpage resource directory are moved to the first directory.
[0066] In one embodiment of the present invention, the static web page resource directory includes at least web page image files, files with the suffix .js for storing javascript scripts (corresponding to the first file proposed in the embodiment of the present invention), and files with the suffix .css for controlling the style of the static web page and separating the style information from the static web page content (corresponding to the second file proposed in the embodiment of the present invention). It may also include text, sound, FLASH animation, client scripts, ActiveX controls, JAVA applets, etc.
[0067] In one embodiment of the present invention, the first directory may be a folder directory established under the static web page resource directory, and the folder directory may be a compressed folder directory, which is used to store files with suffixes of .js and .css in the static web page resource directory.
[0068] In step S120, signature information is added to the file name of the image file in the static webpage resource file directory and the file is moved to the second directory.
[0069] In one embodiment of the present invention, the contents of web page image files, .js files, and .css files in the static web page resource file directory may be updated. Therefore, the embodiment of the present invention obtains signature information corresponding to the file by performing MD5 operation on each file in the static web page resource file directory. For files with the same file name, the signature information before and after the update is completely different. The update status of files such as web page image files, .js files, and .css files in the static web page resource file directory can be determined through the signature information.
[0070] In one embodiment of the present invention, based on the aforementioned scheme, a script program such as Node.js can be used to implement fast MD5 operations on files in a static web resource file directory, generate signature information corresponding to the file, and write the signature information into the file name of the file.
[0071] In one embodiment of the present invention, when it is detected that a new image file has been added to the second directory, the image files with the same file name in the second directory are cleaned up, and a preset number of image files within a preset time period are retained, so that only a few versions of image files in the most recent time period are retained in the second directory, ensuring that different versions of HTML can be supported at the same time and can be loaded to the correct file.
[0072] In step S130, based on the file names of the picture files in the second directory, the reference relationship between the referenced picture files of the first file and the second file in the first directory is updated.
[0073] In one embodiment of the present invention, based on the aforementioned scheme, the .js files and .css files in the first directory are traversed to determine the reference relationship between the .js files and the .css files referencing the image files; the file names of the .js files and the reference relationship of the .css files in the first directory are replaced with the file names of the image files referenced in the second directory; and signature information is added to the file names of the .js files and the .css files after the file names are replaced.
[0074] In one embodiment of the present invention, based on the aforementioned scheme, it is first necessary to determine the image files referenced by the .js files and the .css files, and then search for the corresponding image files in the second directory, and replace the file names of the .js files and the .css files according to the file names of the found image files to ensure that the .js files and the .css files in the first directory can reference the latest and correct image files, so that the static web page resources can be loaded correctly after the update.
[0075] In step S140, based on the updated first and second files in the first directory, the third file in the static webpage resource directory is updated.
[0076] In one embodiment of the present invention, the reference relationship between the .js file and the .css file referenced by the html file (corresponding to the third file proposed in the embodiment of the present invention) in the static web page resource directory is updated to reference the .js file and the .css file in the first directory.
[0077] In one embodiment of the present invention, based on the above scheme, the html files in the static web page resource directory can be traversed to find references to .js files and .css files therein, and replace them with the corresponding .js files and .css files with the latest modification date in the first directory.
[0078] In step S150, the updated third file, the first directory and the second directory are packaged to achieve loading of static web page resources.
[0079] In one embodiment of the present invention, after receiving a request sent by a browser client, the resource server packages the updated html file, the .js file and the .css file in the first directory, and the image file in the second directory, and in response to the browser client request, sends the packaged files to the browser client so that the browser client can load the correct resource file, and the browser client can selectively load the resource file that has been modified recently, thereby reducing network requests, effectively improving the loading speed, and providing a better service experience.
[0080] The following is a detailed description of the method for loading static web page resources proposed in an embodiment of the present invention with a specific application example. The static web page resource directory includes: directory A, directory B, css folder, js folder, image folder, and html file, wherein directory A corresponds to the first directory, directory B corresponds to the second directory, the css folder includes .css files, the js folder includes .js files, and the image folder includes picture files in .png format.
[0081] Figure 2 The flowchart of the actual application static web page resource loading method according to an embodiment of the present invention is schematically shown.
[0082] Reference Figure 2 As shown, a method for loading static web page resources according to an embodiment of the present invention includes the following steps:
[0083] Step S201, obtaining files in a static webpage resource directory;
[0084] In one embodiment of the present invention, the static web page resource directory may be:
[0085] / zip / A
[0086] / zip / B
[0087] / css / xx.css
[0088] / js / xx.js
[0089] / image / xx.png
[0090] / xx.html
[0091] Among them, xx is the file name, and the files that have a mutual reference relationship have the same file name.
[0092] Step S202, merge and compress the .css file and the .js file, and move them to directory A;
[0093] Step S203, append MD5 signature to the file name of the file in the image folder and move it to the B directory;
[0094] Among them, the MD5 signature can be 123, so the file name of the image file after the signature is appended can be xx-123.png.
[0095] Step S204, clean up the files in directory B, and only keep the 5 versions of files in the most recent time period;
[0096] Among them, the image files with the same file name in directory B are cleaned up, and only 5 versions of files in the most recent time period can be retained. The specific number of files to be saved can be set according to actual needs.
[0097] Step S205, traverse the files in directory A, find the references of the image files therein, and replace them with the corresponding image names with suffixes in directory B;
[0098] Step S206, adding an MD5 signature to the file name of the file in directory A;
[0099] Step S207, clean up the files in directory A and only keep the 5 versions of files in the most recent time period;
[0100] Among them, the .css files and .js files with the same file name in directory A are cleaned up, and only 5 versions of .css files and .js files in the most recent time period can be retained. The specific number of files to be saved can be set according to actual needs.
[0101] Step S208, traverse the html files in the static webpage resource directory, find the reference relationship between the .css files and the .js files, and replace them with the .css files and .js files in the A directory;
[0102] Step S209, obtaining the updated HTML file, the first directory and the second directory;
[0103] Among them, the updated static web page resource directory can be:
[0104] / zip / A.xx-123.css
[0105] / zip / A / xx-234.js
[0106] / zip / B / xx-453.png
[0107] / css / xx.css
[0108] / js / xx,png
[0109] / xx.html
[0110] Step S210, the zip directory and the corresponding html file are packaged and published, and the browser client loads the static web page resources according to the packaged file.
[0111] The following describes an apparatus embodiment of the present invention, which can be used to execute the above-mentioned method for loading static web page resources of the present invention.
[0112] Figure 3 A block diagram of a static webpage resource loading device according to an embodiment of the present invention is schematically shown.
[0113] Reference Figure 3 As shown, a static webpage resource loading device 300 according to an embodiment of the present invention includes: a first moving module 301, a second moving module 302, a first updating module 303, a second updating module 304, and a packaging module 305; wherein,
[0114] A first moving module 301 is used to move the first file and the second file in the static webpage resource directory to the first directory;
[0115] The second moving module 302 is used to add signature information to the file name of the image file in the static webpage resource file directory and move it to the second directory;
[0116] A first updating module 303, configured to update a reference relationship between a first file and a second file in the first directory and a referenced image file based on the file name of the image file in the second directory;
[0117] A second updating module 304, configured to update a third file in the static webpage resource directory based on the updated first file and second file in the first directory;
[0118] The packaging module 305 is used to package the updated third file, the first directory and the second directory to realize the loading of static web page resources.
[0119] In one embodiment of the present invention, the above-mentioned device further includes:
[0120] The first cleaning module 306 is used to clean up the picture files with the same file name in the second directory when it is detected that a new picture file is added to the second directory, and retain a preset number of picture files within a preset time period.
[0121] In one embodiment of the present invention, the first updating module 303 is specifically used for:
[0122] Traverse the first file and the second file in the first directory to determine the reference relationship between the first file and the second file referencing the image file;
[0123] Replace the file name of the first file in the first directory with the reference relationship between the first file and the second file with the file name of the picture file referenced in the second directory;
[0124] Signature information is added to the file name of the first file and the file name of the second file after the file name is replaced.
[0125] In one embodiment of the present invention, the above device further comprises:
[0126] The second cleaning module 307 is used to clean up the files with the same file name in the updated second directory, and retain a preset number of first files and second files within a preset time period.
[0127] In one embodiment of the present invention, the second updating module 304 is specifically used for:
[0128] The reference relationship between the first file and the second file referenced by the third file in the static webpage resource directory is updated to reference the first file and the second file in the first directory.
[0129] Since the various functional modules of the static web page resource loading device of the exemplary embodiment of the present invention correspond to the steps of the exemplary embodiment of the static web page resource loading method described above, for details not disclosed in the embodiment of the device of the present invention, please refer to the embodiment of the static web page resource loading method described above of the present invention.
[0130] Reference below Figure 4 , which shows a schematic diagram of the structure of a computer system 400 of an electronic device suitable for implementing an embodiment of the present invention. Figure 4 The computer system 400 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0131] like Figure 4 As shown, computer system 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage part 408 into a random access memory (RAM) 403. Various programs and data required for system operation are also stored in RAM 403. CPU 401, ROM 402 and RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to bus 404.
[0132] The following components are connected to the I / O interface 405: an input section 1206 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.
[0133] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 409, and / or installed from a removable medium 411. When the computer program is executed by a central processing unit (CPU) 401, the above-mentioned functions defined in the system of the present application are executed.
[0134] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0135] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0136] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.
[0137] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the terminal data verification method in the above embodiment.
[0138] For example, the electronic device described above can be implemented as follows: Figure 1 As shown in: Step S110, move the first file and the second file under the static web page resource directory to the first directory; Step S120, add signature information to the file name of the image file under the static web page resource file directory, and move it to the second directory; Step S130, based on the file name of the image file under the second directory, update the reference relationship of the referenced image file between the first file and the second file in the first directory; Step S140, based on the updated first file and second file in the first directory, update the third file under the static web page resource directory; Step S150, package the updated third file, the first directory and the second directory to realize the loading of static web page resources.
[0139] For example, the electronic device described above can be implemented as follows: Figure 2 The steps shown.
[0140] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0141] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0142] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0143] It should be understood that the present invention is not limited to the exact construction that has been 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 invention is limited only by the appended claims.
Claims
1. A method for loading static web page resources, It is characterized in that include: Move the first file and the second file in the static webpage resource directory to the first directory; Add signature information to the file name of the image file under the static webpage resource file directory, and move it to the second directory, wherein the signature information is used to determine the update status of the image file under the static webpage resource file directory; Based on the file names of the picture files in the second directory, updating the reference relationship between the referenced picture files of the first file and the second file in the first directory; Based on the updated first and second files in the first directory, updating the third file in the static webpage resource directory; Packing the updated third file, the first directory and the second directory to load static web page resources; Among them, after adding signature information to the file name of the image file under the static web page resource file directory and moving it to the second directory, the method also includes: when it is detected that a new image file is added to the second directory, the image files with the same file name in the second directory are cleaned up, and a preset number of image files within a preset time period are retained.
2. The method for loading static web page resources according to claim 1, It is characterized in that The updating of the reference relationship between the referenced image files of the first file and the second file in the first directory based on the file names of the image files in the second directory includes: Traversing the first file and the second file in the first directory to determine a reference relationship between the first file and the second file referring to the image file; Replace the file name of the first file in the first directory and the reference relationship between the second file with the file name of the picture file referenced in the second directory; Signature information is added to the file name of the first file and the file name of the second file after the file name is replaced.
3. The method for loading static web page resources according to claim 1, It is characterized in that After updating the reference relationship between the referenced image files of the first file and the second file in the first directory, the method further includes: The files with the same file name in the updated second directory are cleaned up, and a preset number of first files and second files within a preset time period are retained.
4. The method for loading static web page resources according to claim 1, It is characterized in that The updating of the third file in the static webpage resource directory based on the updated first file and second file in the first directory includes: The reference relationship between the first file and the second file referenced by the third file in the static webpage resource directory is updated to reference the first file and the second file in the first directory.
5. A device for loading static web page resources, It is characterized in that include: A first mobile module, a second mobile module, a first update module, a second update module, and a packaging module; wherein: A first moving module, used to move the first file and the second file in the static webpage resource directory to the first directory; A second moving module, used to add signature information to the file names of the image files in the static webpage resource file directory and move them to the second directory, wherein the signature information is used to determine the update status of the image files in the static webpage resource file directory; A first updating module, configured to update a reference relationship between a first file and a second file in the first directory and a referenced image file based on the file name of the image file in the second directory; A second updating module, configured to update a third file in the static webpage resource directory based on the updated first file and second file in the first directory; A packaging module, used for packaging the updated third file, the first directory and the second directory to realize the loading of static web page resources; Among them, the loading device for static web page resources also includes: a first cleaning module, which is used to clean up the image files with the same file name in the second directory when it is detected that new image files are added to the second directory, and retain a preset number of image files within a preset time period.
6. The static web page resource loading device according to claim 5, It is characterized in that The first update module is specifically used for: Traversing the first file and the second file in the first directory to determine a reference relationship between the first file and the second file referring to the image file; Replace the file name of the first file in the first directory and the reference relationship between the second file with the file name of the picture file referenced in the second directory; Signature information is added to the file name of the first file and the file name of the second file after the file name is replaced.
7. The static web page resource loading device according to claim 5, It is characterized in that The device also includes: The second cleaning module is used to clean up the files with the same file name in the updated second directory, and retain a preset number of first files and second files within a preset time period.
8. The static web page resource loading device according to claim 5, It is characterized in that The second update module is specifically used for: The reference relationship between the first file and the second file referenced by the third file in the static webpage resource directory is updated to reference the first file and the second file in the first directory.
9. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method for loading static web page resources described in any one of claims 1 to 4 is implemented.
10. An electronic device, It is characterized in that include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the method for loading static web page resources described in any one of claims 1 to 4.
