CN116932081A - Resource loading method and device based on webpage - Google Patents

Resource loading method and device based on webpage Download PDF

Info

Publication number
CN116932081A
CN116932081A CN202310906654.XA CN202310906654A CN116932081A CN 116932081 A CN116932081 A CN 116932081A CN 202310906654 A CN202310906654 A CN 202310906654A CN 116932081 A CN116932081 A CN 116932081A
Authority
CN
China
Prior art keywords
resource
local
message
link
browser
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310906654.XA
Other languages
Chinese (zh)
Inventor
贺三元
王金生
黄文博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai 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 Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202310906654.XA priority Critical patent/CN116932081A/en
Publication of CN116932081A publication Critical patent/CN116932081A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the specification provides a resource loading method and device based on a webpage, wherein the resource loading method based on the webpage comprises the following steps: in the process of loading the local resources on the webpage of the browser built in the application program, acquiring a message request generated by the browser, detecting whether a resource link carried by the message request is the local resource link, intercepting the message request and effectively detecting the local resources, if the message request is detected, configuring a message header carried by the message request based on the resource parameters of the local resources, reading resource data of the local resources according to the configured message header, and returning a message response carrying the configured message header and the resource data to the browser, so that the browser loads the local resources on the webpage according to the message response.

Description

Resource loading method and device based on webpage
Technical Field
The present document relates to the field of web page technologies, and in particular, to a web page-based resource loading method and device.
Background
With the popularization of intelligent mobile terminals, the types of application programs on the mobile terminals are more and more, and the functions are also more and more abundant, wherein web pages are often embedded in many application programs, in this case, when the mobile terminal receives an access request of a certain web page of the application program, the web page data of the web page can be obtained from a web page server, and the web page data is loaded to the application program for display. However, as application of the embedded web page of the application program in the actual scene becomes wider, higher requirements are put on access of the embedded web page of the application program.
Disclosure of Invention
One or more embodiments of the present disclosure provide a web-based resource loading method, which is applied to a processing component of a browser built in an application program, and the method includes: and acquiring the message request generated by the browser. The message request is generated for a load instruction of a local resource submitted at a web page. The message request carries a resource link and a message header. And detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource. And if the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration. And returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
One or more embodiments of the present specification provide a web-based resource loading apparatus, which is a processing component of a browser running in an application, and includes: and the message request acquisition module is configured to acquire the message request generated by the browser. The message request is generated for a load instruction of a local resource submitted at a web page. The message request carries a resource link and a message header. And the resource link detection module is configured to detect whether the resource link is a local resource link, if so, intercept the message request and effectively detect the local resource. And the configuration reading module is configured to configure the message header based on the resource parameters of the local resources if the effective detection passes, and read the resource data of the local resources according to the message header obtained by configuration. And the message response return module is configured to return a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
One or more embodiments of the present specification provide a terminal device, including: a processor; and a memory configured to store computer-executable instructions that, when executed, cause the processor to: and acquiring a message request generated by a browser built in the application program. The message request is generated for a load instruction of a local resource submitted at a web page. The message request carries a resource link and a message header. And detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource. And if the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration. And returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
One or more embodiments of the present specification provide a storage medium storing computer-executable instructions that, when executed by a processor, implement the following: and acquiring a message request generated by a browser built in the application program. The message request is generated for a load instruction of a local resource submitted at a web page. The message request carries a resource link and a message header. And detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource. And if the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration. And returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
Drawings
For a clearer description of one or more embodiments of the present description or of the solutions of the prior art, the drawings that are needed in the description of the embodiments or of the prior art will be briefly described below, it being obvious that the drawings in the description that follow are only some of the embodiments described in the present description, from which other drawings can be obtained, without inventive faculty, for a person skilled in the art;
FIG. 1 is a schematic diagram of an implementation environment of a web-based resource loading method according to one or more embodiments of the present disclosure;
FIG. 2 is a process flow diagram of a web-based resource loading method provided in one or more embodiments of the present disclosure;
FIG. 3 is a process flow diagram of a web-based resource loading method for a mobile terminal HTML page scenario according to one or more embodiments of the present disclosure;
FIG. 4 is a process flow diagram of a web-based resource loading method for use in a reimbursement scenario in accordance with one or more embodiments of the present disclosure;
fig. 5 is a schematic structural diagram of a terminal device according to one or more embodiments of the present disclosure.
Detailed Description
In order to enable a person skilled in the art to better understand the technical solutions in one or more embodiments of the present specification, the technical solutions in one or more embodiments of the present specification will be clearly and completely described below with reference to the drawings in one or more embodiments of the present specification, and it is obvious that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments, which can be made by one or more embodiments of the present disclosure without inventive effort, are intended to be within the scope of the present disclosure.
The method for loading the resource based on the webpage provided by one or more embodiments of the present disclosure may be suitable for an implementation environment of local resource loading on a webpage of a terminal device, where the implementation environment at least includes the terminal device 101 and the webpage server 102, an application program with a built-in browser is running on the terminal device 101, the application program can access the webpage through the built-in browser, and the browser is further configured with a processing component that responds to a message request generated by the processing browser. In addition, the implementation environment may further include an application server of the application program, and the application server responds to the access request of the application program and returns a corresponding processing result.
The web server 102 may be one or more servers, a server cluster formed by a plurality of servers, or a cloud server of a cloud computing platform, configured to respond to a message request submitted by a browser, and return a message response obtained by the response to the browser; the terminal device 101 may be a smart phone, a tablet computer, an electronic book reader, a wearable device, a device that performs information interaction based on AR (Augmented Reality) and VR (Virtual Reality), and the like.
In the implementation environment, in the process of accessing the webpage of the application program, a processing component acquires a message request generated by the browser and detects the message request, if the message request is detected to be the message request for loading the local resource on the webpage of the browser, the processing component intercepts the message request, locally processes the response of the message request after the interception, and returns the message response obtained by the response process to the browser, so that the browser can load the local resource on the webpage according to the returned message response, and the local resource loading on the webpage of the local application program of the terminal equipment 101 is realized.
One or more embodiments of a web page-based resource loading method provided in the present specification are as follows:
referring to fig. 2, the method for loading resources based on web pages provided in the present embodiment is applied to a processing component of a browser built in an application, and the method specifically includes steps S202 to S208.
Step S202, obtaining the message request generated by the browser.
In this embodiment, the application program runs on the terminal device. The application program running by the terminal equipment is internally provided with a browser, and the browser can be an embedded browser or a browser engine, such as Webview; in addition, the browser can also be a webpage processing interface or a module for processing webpages, and when the webpages are accessed, the webpage processing interface or the module calls a corresponding interface provided by a system browser installed in the terminal equipment for webpage access.
In the specific implementation, in the process of accessing the webpage by the application program, the built-in browser of the application program is used for accessing the webpage, particularly in the process of accessing the webpage, when the local resource of the terminal equipment (namely, the local resource of the application program/the browser) is loaded by the webpage of the browser, the processing component is configured in the browser, the configured processing component intercepts the message request for loading the local resource submitted by the browser, responds to the message request for loading the local resource in the local area, and returns the response message obtained by the response processing to the browser, so that the webpage access mode of 'local request- > local response' is realized. The following describes a specific processing procedure of the processing component for the message request for loading the local resource in connection with step S204 and step S208.
The processing component of the browser is an interceptor for intercepting a message request generated by the browser, specifically, intercepting the message request loaded with the local resource, not sending the message request to a web server locally, and carrying out response processing on the message request loaded with the local resource locally. The local resource refers to a resource stored on a terminal device running an application program, and specifically, the local resource may be an image resource, a video resource, an audio resource and/or a text resource.
The message request is generated for a load instruction of a local resource submitted on a web page, and the message request carries a resource link and a message header. Wherein, the resource link refers to an access link for accessing a local resource; the message Header refers to the Header of the message request. Optionally, the web page includes an HTML (Hyper Text Markup Language ) page stored at a web server.
In an example, in a process of accessing an HTML page through a browser built in an application program, on the basis that the HTML page is configured with a loading control for loading a local image or a local video stored in a mobile terminal, the browser generates a message request for loading the local image or the local video after the loading control is triggered, and an interceptor configured by the browser acquires the message request for loading the local image or the local video generated by the browser.
Step S204, whether the resource link is a local resource link is detected, if yes, the message request is intercepted, and effective detection is carried out on the local resource.
When the method is implemented, after a message request generated by a browser is acquired, a processing component detects whether a currently acquired message request is a loading request for loading local resources on a webpage of the browser by detecting whether a resource link carried by the message request is a local resource link, if so, the message request is intercepted, and the local resources are further effectively detected;
if it is detected that the currently acquired message request is not a message request for loading a local resource on a web page of the browser, the message request can be sent to the web server without intercepting the message request, so that a message response of the message request is generated and returned by the web server.
In particular, in the process of detecting whether the resource link carried by the message request is a local resource link, the message request detected as loading the local resource on the web page of the browser is intercepted and responded locally, while the message request not loaded on the web page of the browser is sent to the web server for responding and processing, so as to improve the interception accuracy of the message request and avoid causing the interception of the message request, in an optional implementation manner provided in this embodiment, whether the resource link is a local resource link is detected by adopting the following manner:
Analyzing the resource links to obtain link fields, and detecting whether the link fields contain resource identification fields or not;
if the resource identification field is included, detecting whether the link field contains a local resource address, and if the link field contains the local resource address, determining that the resource link is a local resource link; if the local resource address is not included, the message request can be sent to the webpage server so as to generate and return a message response of the message request by the webpage server;
if the resource identification field is not included, the message request may be sent to the web server to generate and return a message response to the message request by the web server.
Optionally, the local resource address is obtained by reading a storage address of the local resource in the terminal device.
For example, in the process of loading the local picture stored in the mobile terminal by the HTML page, when the storage address of the local picture in the mobile terminal is "xx/xxxx/xx1", the storage address "xx/xxxx/xx1" is used as the local resource address for loading the local picture, and the resource link for loading the local picture generated on the basis is: "http:// image:// xx/xxxx/xx1", wherein "image" is a resource identification field of a local resource of the type of local tile;
Similarly, the resource identifier field of the local resource of the local video is "video", and the resource link carried in the message request for loading the local video is: "http:// video:// xx/xxxx/xx2", wherein "xx/xxxx/xx2" is the storage address of the local video at the mobile terminal.
In a specific implementation process, in a process of effectively detecting a local resource, a method of detecting a link format of a resource link and resource header information of the local resource can be used for effectively detecting the local resource loaded on a webpage of a browser, so that a loading success rate of loading the local resource on the webpage of the browser is improved, and in an alternative implementation provided in this embodiment, the method for effectively detecting the local resource includes:
detecting whether the link format of the resource link is the link format corresponding to the resource type of the local resource;
if yes, reading the resource head information of the local resource carried by the message body, detecting whether the local resource is an effective resource or not based on the resource head information, and if yes, determining that the effective detection passes; if the load abnormal reminding is not the effective resource, determining that the effective detection is not passed, and generating the load abnormal reminding or not processing the effective detection;
If not, determining that the effective detection is not passed, and not processing or generating a loading exception reminder.
In practical application, in order to ensure the security of local resources and avoid the occurrence of data security risk caused by leakage or interception of the local resources, a domain name white list can be set for web pages of a browser, the web pages in the domain name white list can be loaded with the local resources, and the web pages which are not in the domain name white list cannot be loaded with the local resources, on the basis, whether the web pages which are currently loaded with the local resources are credible is detected by detecting whether the web pages which are currently loaded with the local resources are in the domain name white list, namely: by detecting the domain name white list of the webpage, only the trusted webpage is ensured to be loaded with local resources, and the risk that local data is leaked due to the fact that the untrusted webpage is loaded with the local resources is avoided.
Specifically, after intercepting a message request for loading a local resource, before performing effective detection on the local resource, performing domain name security detection on a web page for loading the local resource, so as to ensure the security of the local resource, in an optional implementation manner provided in this embodiment, performing domain name security detection by verifying whether a domain name of the web page exists in a domain name white list, if the domain name of the web page currently performing local resource loading exists in the domain name white list, indicating that the domain name of the web page currently performing local resource loading is trusted, performing a processing procedure for performing effective detection on the local resource;
If the domain name of the webpage currently loaded with the local resource does not exist in the domain name white list, the domain name of the webpage currently loaded with the local resource is not trusted, and the processing is not performed or a webpage untrusted reminder is generated.
Optionally, the domain name white list is configured at a web server and obtained from the web server. The process of specifically acquiring the domain name white list acquires the domain name white list from the web server for domain name security detection on the web page loaded with the local resource before acquiring the message request, for example, in the case of detecting an access instruction of the browser in the application program.
Step S206, if the effective detection is passed, configuring the message header based on the resource parameters of the local resources, and reading the resource data of the local resources according to the message header obtained by configuration.
The message request loading the local resource is intercepted, and under the condition that the local resource is effectively detected to pass, the processing component carries out local response processing on the message request, and in the specific response processing process, the message header carried by the message request is configured based on the resource parameter of the local resource, and the resource data of the local resource is read according to the message header obtained by configuration.
In an optional implementation manner provided in this embodiment, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration includes:
acquiring the resource parameters of the local resources, and updating the initialization parameters of the message header based on the acquired resource parameters;
and reading the resource data of the local resource at the terminal equipment according to the updated and obtained updated parameters, and writing the read resource data into the message response.
Along the above example, in the process of loading the local image stored in the mobile terminal by the HTML page, reading the size of the local image, and carrying a Header in a message request for loading the local image, wherein the initialization parameters of the Header include range and size, and configuring range and size of the Header according to the size of the local image to obtain a configured Header;
after the configuration of the Header is completed, reading the local picture from the mobile terminal to the memory according to the range and size of the configured Header, and writing the local picture in the memory into a response request corresponding to the message request after the reading of the local picture is completed.
Step S208, a message response carrying the message header obtained by configuration and the resource data is returned to the browser, so that the browser loads the local resource on the webpage according to the message response.
After the configuration of the message header of the local resource and the reading of the resource data of the local resource are completed, a message response carrying the message header and the resource data obtained by configuration is returned to the browser and used as a response of the processing component to the message request generated by the browser, after the resource data carrying the message header and the local resource obtained by configuration is returned to the browser, the browser can load the local resource on the webpage according to the message header and the resource data of the local resource obtained by configuration, thereby realizing a webpage access mode of ' local request- > ' local response '.
In an optional implementation manner provided in this embodiment, loading the local resource on the web page according to the message response includes: and rendering the local resources according to the message header and the resource data carried by the message response, and displaying the rendering result of the local resources on the webpage.
In practical application, in a scene that an application program adopts a webpage to provide services, on the basis that the webpage of a browser built in the application program loads and displays local resources, a local editing function of the local resources can be provided on the basis that the webpage of the browser displays the local resources, and specifically, when the browser detects an editing instruction of a rendering result displayed on the webpage, editing processing of the local resources can be performed according to the editing instruction.
In summary, according to the one or more web-based resource loading methods provided in this embodiment, based on configuring a processing component for intercepting a message request generated by a browser with respect to a browser built in an application program, the processing component is used to perform local resource link detection on a resource link carried by the message request, and in the case that the message request is detected to be a message request for loading a local resource, intercept the message request, perform effective detection on the local resource, configure a message header carried by the message request after the effective detection passes, perform resource data reading of the local resource, generate a message response corresponding to the message request according to the configured message header and the read resource data of the local resource, and perform response processing on the message request intercepted by the processing component as a response processing on the message request intercepted by the browser, so as to implement local resource loading performed on the browser side, thereby facilitating flexibility of local resource processing on the browser local side.
Further, setting a domain name white list for a webpage accessed by a built-in browser of an application program, and detecting whether the webpage currently loaded with the local resource is credible or not by detecting whether the webpage currently loaded with the local resource is in the domain name white list, namely: by detecting the domain name white list of the webpage, only the trusted webpage is ensured to be loaded with local resources, and the risk that local data is leaked due to the fact that the untrusted webpage is loaded with the local resources is avoided.
The following takes an application of the webpage-based resource loading method provided in this embodiment to an HTML page scene of a mobile terminal as an example, and further describes the webpage-based resource loading method provided in this embodiment with reference to fig. 3, and referring to fig. 3, the webpage-based resource loading method applied to the HTML page scene of the mobile terminal specifically includes the following steps.
Step S302, a message request generated by an embedded browser of an application program operated by the mobile terminal is obtained.
Wherein the message request is generated for a load instruction to load the local image stored by the mobile terminal on the HTML page.
Step S304, analyzing the image link carried by the message request to obtain a link field, and detecting whether the link field contains an image identification field;
if so, executing step S306;
if not, go to step S308.
Step S306, detecting whether the link field contains a terminal storage address;
if so, executing step S310;
if not, go to step S308.
Step S308, a message request is sent to the web server to generate and return a message response of the message request by the web server.
Step S310, intercepting a message request and verifying whether a domain name of an HTML page exists in a domain name white list;
If so, execute step S312;
if not, the processing is not performed or an untrusted reminder of the HTML page is generated.
Step S312, detecting whether the link format of the image link is the image link format corresponding to the image type;
if yes, go to step S314;
if not, the processing is not performed or a loading exception prompt is generated.
Step S314, based on the image header information carried by the message body of the message request, detecting whether the local image is a valid image;
if yes, go to step S316 to step S320;
if not, the processing is not performed or an image invalidation reminder is generated.
Step S316, configuring initialization parameters of the Header based on the acquired image size of the local image.
Step S318, reading the image data of the local image at the mobile terminal according to the configured Header, and writing the read image data into the message response.
Step S320, the embedded browser returns a message response carrying the configured Header and the image data, so that the embedded browser performs rendering and displaying of the local image on the HTML page according to the message response.
The embodiment of the resource loading device based on the webpage provided in the specification is as follows:
in the foregoing embodiments, a method for loading resources based on a web page is provided, and a device for loading resources based on a web page is provided correspondingly, which are described below with reference to the accompanying drawings.
Referring to fig. 4, a schematic diagram of an embodiment of a web-based resource loading device according to the present embodiment is shown.
Since the apparatus embodiments correspond to the method embodiments, the description is relatively simple, and the relevant portions should be referred to the corresponding descriptions of the method embodiments provided above. The device embodiments described below are merely illustrative.
The embodiment provides a resource loading device based on a webpage, which comprises the following components:
a message request acquisition module 402 configured to acquire a message request generated by the browser; the message request is generated for a loading instruction of a local resource submitted on a webpage, and the message request carries a resource link and a message header;
a resource link detection module 404, configured to detect whether the resource link is a local resource link, if so, intercept the message request, and perform effective detection on the local resource;
a configuration reading module 406, configured to configure the message header based on the resource parameter of the local resource if the effective detection passes, and read the resource data of the local resource according to the message header obtained by configuration;
and a message response returning module 408 configured to return a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the web page according to the message response.
An embodiment of a terminal device provided in the present specification is as follows:
according to the above-described method for loading resources based on web pages, based on the same technical concept, one or more embodiments of the present disclosure further provide a terminal device, where the terminal device is configured to execute the above-provided method for loading resources based on web pages, and fig. 5 is a schematic structural diagram of one or more embodiments of the present disclosure.
The terminal device provided in this embodiment includes:
as shown in fig. 5, the terminal device may have a relatively large difference due to different configurations or performances, and may include one or more processors 501 and a memory 502, where the memory 502 may store one or more storage applications or data. Wherein the memory 502 may be transient storage or persistent storage. The application programs stored in memory 502 may include one or more modules (not shown), each of which may include a series of computer-executable instructions in the terminal device. Still further, the processor 501 may be arranged to communicate with the memory 502 and execute a series of computer executable instructions in the memory 502 on the terminal device. The terminal device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input/output interfaces 505, one or more keyboards 506, etc.
In a particular embodiment, a terminal device includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the terminal device, and configured to be executed by one or more processors, the one or more programs comprising computer-executable instructions for:
acquiring a message request generated by a browser built in an application program; the message request is generated for a loading instruction of a local resource submitted on a webpage, and the message request carries a resource link and a message header;
detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource;
if the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration;
and returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
An embodiment of a storage medium provided in the present specification is as follows:
corresponding to the above-described webpage-based resource loading method, one or more embodiments of the present disclosure further provide a storage medium based on the same technical concept.
The storage medium provided in this embodiment is configured to store computer executable instructions that, when executed by a processor, implement the following flow:
acquiring a message request generated by a browser built in an application program; the message request is generated for a loading instruction of a local resource submitted on a webpage, and the message request carries a resource link and a message header;
detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource;
if the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration;
and returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
It should be noted that, in the present specification, an embodiment of a storage medium and an embodiment of a web-based resource loading method in the present specification are based on the same inventive concept, so that a specific implementation of the embodiment may refer to an implementation of the foregoing corresponding method, and a repetition is omitted.
In this specification, each embodiment is described in a progressive manner, and the same or similar parts of each embodiment are referred to each other, and each embodiment focuses on the differences from other embodiments, for example, an apparatus embodiment, and a storage medium embodiment, which are all similar to a method embodiment, so that description is relatively simple, and relevant content in reading apparatus embodiments, and storage medium embodiments is referred to the part description of the method embodiment.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In the 30 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each unit may be implemented in the same piece or pieces of software and/or hardware when implementing the embodiments of the present specification.
One skilled in the relevant art will recognize that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising at least one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
One or more embodiments of the present specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The foregoing description is by way of example only and is not intended to limit the present disclosure. Various modifications and changes may occur to those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. that fall within the spirit and principles of the present document are intended to be included within the scope of the claims of the present document.

Claims (13)

1. A web-based resource loading method, applied to a processing component of a browser built in an application program, comprising:
acquiring a message request generated by the browser; the message request is generated for a loading instruction of a local resource submitted on a webpage, and the message request carries a resource link and a message header;
detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource;
if the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration;
and returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
2. The web page-based resource loading method according to claim 1, wherein whether the resource link is a local resource link is detected by:
analyzing the resource links to obtain link fields, and detecting whether the link fields contain resource identification fields or not;
if so, detecting whether the link field contains a local resource address, and if so, determining that the resource link is a local resource link.
3. The web-based resource loading method according to claim 2, wherein the application program is run on a terminal device;
and the local resource address is obtained by reading the storage address of the local resource in the terminal equipment.
4. The web-based resource loading method according to claim 1, wherein the effectively detecting the local resource includes:
detecting whether the link format of the resource link is the link format corresponding to the resource type of the local resource;
if yes, reading the resource head information of the local resource carried by the message body, detecting whether the local resource is an effective resource or not based on the resource head information, and if yes, determining that the effective detection is passed.
5. The web-based resource loading method according to claim 1, wherein after intercepting the message request, before the performing the effective detection on the local resource, the method further comprises:
verifying whether the domain name of the webpage exists in the domain name white list, if so, executing the next step;
the domain name white list is configured in a webpage server and obtained from the webpage server.
6. The method for loading resources based on web pages according to claim 1, wherein the configuring the message header based on the resource parameters of the local resources and reading the resource data of the local resources according to the message header obtained by configuration comprises:
acquiring the resource parameters of the local resources, and updating the initialization parameters of the message header based on the acquired resource parameters;
and reading the resource data of the local resource at the terminal equipment according to the updated and obtained updated parameters, and writing the read resource data into the message response.
7. The method for loading resources based on web pages as recited in claim 1, wherein if the detection result after the detection of whether the resource link is a local resource link is no, the following operations are executed:
And sending the message request to a web server to generate and return a message response of the message request by the web server.
8. The web page-based resource loading method according to claim 1, wherein the loading the local resource on the web page according to the message response comprises:
and rendering the local resources according to the message header and the resource data carried by the message response, and displaying the rendering result of the local resources on the webpage.
9. The web-based resource loading method according to claim 8, wherein the browser performs editing processing of the local resource according to an editing instruction when detecting the editing instruction for the rendering result of the web presentation.
10. The web page-based resource loading method according to claim 1, wherein the web page comprises an HTML page stored in a web server.
11. A web-based resource loading device, a processing component of a browser running within an application, the device comprising:
the message request acquisition module is configured to acquire a message request generated by the browser; the message request is generated for a loading instruction of a local resource submitted on a webpage, and the message request carries a resource link and a message header;
The resource link detection module is configured to detect whether the resource link is a local resource link, if so, intercept the message request and effectively detect the local resource;
the configuration reading module is configured to configure the message header based on the resource parameters of the local resources if the effective detection passes, and read the resource data of the local resources according to the message header obtained by configuration;
and the message response return module is configured to return a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
12. A terminal device, comprising:
a processor; and a memory configured to store computer-executable instructions that, when executed, cause the processor to:
acquiring a message request generated by a browser built in an application program; the message request is generated for a loading instruction of a local resource submitted on a webpage, and the message request carries a resource link and a message header;
detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource;
If the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration;
and returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
13. A storage medium storing computer-executable instructions that when executed by a processor implement the following:
acquiring a message request generated by a browser built in an application program; the message request is generated for a loading instruction of a local resource submitted on a webpage, and the message request carries a resource link and a message header;
detecting whether the resource link is a local resource link, if so, intercepting the message request, and effectively detecting the local resource;
if the effective detection passes, configuring the message header based on the resource parameter of the local resource, and reading the resource data of the local resource according to the message header obtained by configuration;
and returning a message response carrying the message header obtained by configuration and the resource data to the browser, so that the browser loads the local resource on the webpage according to the message response.
CN202310906654.XA 2023-07-21 2023-07-21 Resource loading method and device based on webpage Pending CN116932081A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310906654.XA CN116932081A (en) 2023-07-21 2023-07-21 Resource loading method and device based on webpage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310906654.XA CN116932081A (en) 2023-07-21 2023-07-21 Resource loading method and device based on webpage

Publications (1)

Publication Number Publication Date
CN116932081A true CN116932081A (en) 2023-10-24

Family

ID=88389252

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310906654.XA Pending CN116932081A (en) 2023-07-21 2023-07-21 Resource loading method and device based on webpage

Country Status (1)

Country Link
CN (1) CN116932081A (en)

Similar Documents

Publication Publication Date Title
JP6740373B2 (en) Page component dynamic layout
CN104951326B (en) Webpage access method and device
CN111639278B (en) Webpage loading method and device
EP3606010B1 (en) Method and apparatus for processing web application package
CN111831387B (en) Page processing method, device and equipment
CN112364277B (en) Webpage loading method and device
CN107479868B (en) Interface loading method, device and equipment
CN110602163B (en) File uploading method and device
US11176161B2 (en) Data processing method, apparatus, and device
CN111078435A (en) Service processing method and device and electronic equipment
CN113556260A (en) Flow monitoring method and device, storage medium and electronic equipment
CN116932081A (en) Resource loading method and device based on webpage
CN116151199A (en) Method, device and equipment for generating network-connected vehicle test report
CN116302230A (en) Page display method, device and equipment
CN113176988B (en) Data recording method and device
CN113572827B (en) Registration processing method and device
CN111967769B (en) Risk identification method, apparatus, device and medium
CN112306710A (en) Service processing system, interface calling method and device
CN116521144A (en) Program packaging method and device and electronic equipment
CN110175020B (en) Frame attribute information expansion method and device, and frame loading method and device
CN114546639B (en) Service call processing method and device
CN116700869A (en) Page processing method and device of internet traffic (IoT) device
CN115952367A (en) Page display method, device and equipment
CN114296712A (en) Script data processing method and device and electronic equipment
CN116882986A (en) Payment processing method and device based on medical insurance certificate

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