Webpage display method and device, electronic equipment and medium

By injecting JavaScript into the iOS operating system to intercept and transmit HTTP POST request messages, the conflict between downloading and displaying webpage videos was resolved, enabling the webpage to remain displayed normally while the video is being downloaded.

CN114329269BActive Publication Date: 2025-12-09BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111582368.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2025-12-09
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

In existing technologies, there is a problem where webpages cannot display properly while implementing video download functionality.

Method used

By injecting JavaScript into the iOS operating system to intercept HTTP POST request messages generated by the server and sending them to the server through the application, the WKwebview control is bypassed, enabling normal transmission and rendering of data packets.

Benefits of technology

This technology enables the webpage to display normally while downloading webpage videos, resolving the contradiction that existing technologies cannot achieve both simultaneously.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114329269B_ABST
    Figure CN114329269B_ABST
Patent Text Reader

Abstract

The application provides a webpage display method and device, electronic equipment and a medium. After a protocol proxy component is registered in an application, the request content in an Http Post request message sent to a server through a WKwebview control has been lost, the server cannot normally respond to the Http Post request message, based on this, an injection JavaScript script in the browser intercepts an Http Post request message generated by a server JavaScript script, to avoid the server JavaScript script from sending the generated Http Post request message to the WKwebview control; the injection JavaScript script sends the Http Post request message to the application; the application sends the Http Post request message to the server; the data packet fed back by the server in response to the Http Post request message is also transmitted to the server JavaScript script through the application and the injection JavaScript script, so that the server JavaScript script can render and display a webpage based on the data packet. Thus, the normal display of the webpage is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer technology, and in particular to a webpage display method and device, electronic equipment and medium. BACKGROUND

[0002] A user can watch a video through a webpage displayed by an electronic equipment of an iOS operating system. However, the webpage only provides an online watching function of the video, and the user cannot directly obtain a link address of the video, so the user can only watch the video through the webpage and cannot download the video.

[0003] The applicant found in the research process that the reason why the related technology cannot realize the function of downloading a video in a webpage is that if the function of downloading the video in the webpage is realized, the webpage cannot be normally displayed, and if the function of normally displaying the webpage is realized, the function of downloading the video in the webpage cannot be realized.

[0004] Therefore, under the premise of realizing the function of downloading the video in the webpage, making the webpage normally displayed is a technical problem urgently to be solved by the person skilled in the art. SUMMARY

[0005] Therefore, the embodiments of the present application disclose a webpage display method and device, electronic equipment and medium, which solve the problem in the prior art that the webpage cannot be normally displayed under the premise of realizing the function of downloading a video in the webpage. The technical scheme of the present application is as follows.

[0006] According to a first aspect of the embodiments of the present application, a webpage display method is provided, applied to an iOS operating system, and the webpage display method comprises the following steps.

[0007] In the case that a webpage loading instruction is received, a browser built in an application is opened through the application;

[0008] A server JavaScript script is run through the browser to generate an Http Post request message;

[0009] The Http Post request message is intercepted from the server JavaScript script through an injected JavaScript script in the browser;

[0010] The Http Post request message is sent to the application through the injected JavaScript script;

[0011] The Http Post request message is sent to the server through the application;

[0012] sending, by the injection JavaScript script, the data packet to the server JavaScript script;

[0013] sending, by the injection JavaScript script, the data packet to the server JavaScript script;

[0014] rendering and displaying a webpage by the server JavaScript script using the data packet.

[0015] In a first possible implementation manner of the first aspect, the sending, by the injection JavaScript script, of the Http Post request message to the application comprises:

[0016] sending, by the injection JavaScript script, the Http Post request message to a Swift component in the application using a message channel between the injection JavaScript script and the pre-constructed Swift component;

[0017] the sending, by the application, of the Http Post request message to the server comprises:

[0018] sending, by the Swift component in the application, the Http Post request message to the server.

[0019] In a second possible implementation manner of the first aspect, the method further comprises:

[0020] sending, by the Swift component, the data packet to a protocol proxy component in the application;

[0021] obtaining, by the protocol proxy component, an Http Get data packet from the data packet;

[0022] filtering, by the protocol proxy component, a link address with a video identifier from the Http Get data packet;

[0023] downloading a video through the link address.

[0024] In a third possible implementation manner of the first aspect, the downloading of the video through the link address comprises:

[0025] if a video suffix identifier in the link address represents that the video belongs to an M3U8 format, obtaining an index video list through the link address, the index video list comprising a plurality of video link addresses;

[0026] Download the videos respectively through the video link addresses contained in the index video list.

[0027] With reference to the first aspect, in a fourth possible implementation manner, the sniffing download button is displayed on the webpage, and the method further includes:

[0028] If it is detected that the link address of the video in the webpage is acquired, a prompt information is generated, and the prompt information is used to prompt that the user can download the video in the webpage.

[0029] If it is detected that the sniffing download button is pressed, the step of downloading the video through the link address is executed.

[0030] With reference to the first aspect, in a fifth possible implementation manner, the step of intercepting the Http Post request message from the server JavaScript script through the injected JavaScript script injected in the browser includes:

[0031] The Hook function in the injected JavaScript script is used to monitor whether the server JavaScript script generates the Http Post request message.

[0032] If the Hook function in the injected JavaScript script monitors that the server JavaScript script generates the Http Post request message, the Http Post request message is obtained from the server JavaScript script.

[0033] With reference to the first aspect, in a sixth possible implementation manner, the step of opening the browser built in the application through the application in the case that the webpage loading instruction is received includes:

[0034] If the application process of the application receives the webpage loading instruction, the WKwebview component is called.

[0035] The browser is opened through the WKwebview component.

[0036] According to a second aspect of the embodiments of the present disclosure, a webpage display device is provided, and the device includes:

[0037] The starting module is configured to open the browser built in the application through the application in the case that the webpage loading instruction is received.

[0038] The generating module is configured to run the server JavaScript script through the browser to generate the Http Post request message.

[0039] An acquisition module is configured to intercept the Http Post request message from the server JavaScript script through an injected JavaScript script in the browser;

[0040] A first sending module is configured to send the Http Post request message to the application program through the injected JavaScript script;

[0041] A second sending module is configured to send the Http Post request message to the server through the application program;

[0042] A third sending module is configured to send a data packet fed back by the server in response to the Http Post request message to the injected JavaScript script through the application program;

[0043] A fourth sending module is configured to send the data packet to the server JavaScript script through the injected JavaScript script;

[0044] A display module is configured to render and display a webpage by using the data packet through the server JavaScript script.

[0045] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, and the electronic device comprises:

[0046] a processor;

[0047] a memory for storing instructions executable by the processor;

[0048] The processor is configured to execute the instructions to implement the webpage display method according to the first aspect.

[0049] According to a fourth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, and when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the webpage display method according to the first aspect.

[0050] The technical scheme provided by the embodiments of the present disclosure at least has the following beneficial effects: after the protocol proxy component is registered in the application, the request content in the Http Post request message sent to the server through the WKwebview control has been lost, the server cannot normally respond to the Http Post request message, based on this, the application intercepts the Http Post request message generated by the server JavaScript script through the injected JavaScript script in the browser, to avoid the server JavaScript script from sending the generated Http Post request message to the WKwebview control; the injected JavaScript script sends the Http Post request message to the application; the application sends the Http Post request message to the server; the data packet fed back by the server in response to the Http Post request message is also transmitted to the server JavaScript script through the application and the injected JavaScript script, so that the server JavaScript script can render and display the webpage based on the data packet. Thus, the normal display of the webpage is realized. BRIEF DESCRIPTION OF DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on the provided drawings.

[0052] Figure 1 The schematic diagram of the hardware architecture and the software architecture related to the embodiments of the present application;

[0053] Figure 2 The flowchart of the webpage display method provided by the embodiments of the present application;

[0054] Figure 3 The schematic diagram of one implementation of the user interface provided by the embodiments of the present application;

[0055] Figure 4 The flowchart of the webpage video download method provided by the embodiments of the present application;

[0056] Figure 5 The schematic diagram of one implementation of the webpage provided by the embodiments of the present application;

[0057] Figure 6 The structural diagram of the webpage display device provided by the embodiments of the present application;

[0058] Figure 7is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0059] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0060] The present application embodiment provides a webpage display method and device, electronic equipment and medium. Before introducing the present application embodiment, the hardware architecture and software architecture involved in the present application are described.

[0061] As shown in Figure 1 , it is a schematic diagram of the hardware architecture and software architecture involved in the present application.

[0062] As shown in Figure 1 , the hardware architecture includes an electronic device 11 and a server 12; the software architecture mainly refers to the software architecture involved in the electronic device 11, which includes an application program 111, a browser 112 built in the application program 111 and an IOS operating system 113.

[0063] For example, the electronic device 11 can be any electronic product that can interact with the user through one or more ways such as keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device, such as mobile phone, notebook computer, tablet computer, palm computer, personal computer, wearable device, smart TV, PAD, etc.

[0064] It should be noted that Figure 1 only one example, the type of electronic device can be various, not limited to Figure 1 notebook computer in

[0065] For example, the server 12 can be a server, a server cluster composed of multiple servers, or a cloud computing server center. The server 12 can include a processor, a memory and a network interface, etc.

[0066] For example, the electronic device 11 can run the application program 111, which can be a web application program or a client application program.

[0067] The electronic device 11 is installed with an IOS operating system, and the IOS operating system is built-in with a WKWebview control. In the process of running the application program 111, if the user needs to open the browser 112 built-in in the application program 111, the browser 112 can be opened through the WKWebview control.

[0068] After the browser 112 is started, the application program 111 can interact with the server 12.

[0069] Those skilled in the art should understand that the above-mentioned electronic device and server are only examples, and other existing or future electronic devices or servers that can be applicable to the present disclosure should also be included in the protection scope of the present disclosure and are hereby incorporated by reference.

[0070] Secondly, the related technologies involved in the present application are described.

[0071] In order to achieve the purpose of downloading the video in the webpage, it is necessary to register a protocol proxy component in the application program, which is an HTTP / HTTPS (HyperText Transfer Protocol Secure) protocol proxy component. Through the protocol proxy component, the link address of the video in the network can be obtained, so as to achieve the purpose of downloading the video in the webpage.

[0072] However, after registering the protocol proxy component in the application program, the built-in browser in the application program cannot normally display the webpage.

[0073] In the related art, the process of displaying the webpage by the browser includes the following steps A11 to A16.

[0074] Step A11: In the case of receiving a webpage loading instruction, the built-in browser 112 in the application program 111 is opened through the application program 111.

[0075] Step A12: The Http Post request message generated by running the server JavaScript script through the browser 112.

[0076] For example, the server JavaScript script is sent by the server 12 to the electronic device 11.

[0077] Step A13: The Http Post request message is sent to the WKWebview control through the browser 112 running the server JavaScript script.

[0078] Step A14: The Http Post request message is sent to the server 12 through the WKWebview control.

[0079] Step A15: sending the data packet to the WKwebview control through the server 12.

[0080] Step A16: sending the data packet to the server JavaScript script through the WKwebview control.

[0081] Step A17: rendering and displaying the webpage by the server JavaScript script using the data packet.

[0082] It can be understood that in many application scenarios, an Http Post request message will be generated, for example, a keyword retrieval application scenario or a user login application scenario; in the keyword retrieval application scenario, the user will input a keyword in the webpage, the Http Post request message will contain the keyword, and the server will feed back the corresponding retrieval result (i.e., the data packet) based on the keyword carried in the Http Post request message; in the user login application scenario, the user will input a username and a password in the webpage, the Http Post request message will contain the username and the password, and the server will verify whether the user logs in successfully based on the username and the password carried in the Http Post request message, and feed back the corresponding result (i.e., the data packet).

[0083] After the protocol proxy component is registered in the application program, the Http Post request message sent by the WKwebview control to the server is a Http Post request message in which part or all of the request content is discarded, for example, a keyword or a username and a password. Since the request content in the Http Post request message is lost, the server cannot respond to the Http Post request message, for example, the server cannot retrieve based on the keyword to obtain the corresponding retrieval result, and for another example, the server cannot verify whether the user logs in successfully based on the username and the password.

[0084] In order to enable the built-in browser in the application program to still normally display the webpage after the protocol proxy component is registered in the application program, the present application inventors have found, through continuous research, a technical solution of sending the Http Post request message to the server 12 through the application program, in which, in order to bypass the WKwebview control, the server JavaScript script generated Http Post request message needs to be intercepted to avoid the server JavaScript script sending the generated Http Post request message to the WKwebview control; and the application program in the related art cannot send the Http Post request message to the server, and the present application inventors have found, through continuous research, that by registering a Swift component in the application program, the application program can interact with the server.

[0085] The web page display method provided by the embodiments of the present application will be described below in combination with the hardware architecture and the software architecture.

[0086] As shown in the figure, it is a flowchart of the web page display method provided by the embodiments of the present application. The method can be applied to the electronic device in the hardware architecture. The method involves the following steps S21 to S28 in the implementation process. Figure 2

[0087] Step S21: Upon receiving a web page loading instruction, the application opens the browser built in the application.

[0088] In an optional implementation, after the application is started, an application process is created. If the application process detects a web page loading instruction, the application process calls the WKwebview component. The browser is opened through the WKwebview component.

[0089] In an optional implementation, there are various scenarios for generating a web page loading instruction. For example, a web page loading instruction is generated after detecting that a user inputs a URL; or a web page loading instruction is generated after the user selects a collected URL; or a web page loading instruction is generated after the user clicks a URL access button. The above scenarios are only exemplary and are not limited.

[0090] As shown in the figure, it is a schematic diagram of one implementation of the user interface provided by the embodiments of the present application. Figure 3

[0091] The user can input a URL in the "URL input box"; or the user can select the name of a collected web page in the "collected web pages". The name of the web page corresponds to the link address of the web page.

[0092] It can be understood that the "collected web pages" are added by the user (exemplarily, the "add to collection" button can be clicked). In the process of collecting the web page, the user can set the name of the web page, so the corresponding relationship between the name of the web page and the link address of the web page can be established. Exemplarily, the corresponding relationship between the name of the web page and the link address of the web page can be stored in a database, for example, a sqlite database. The sqlite database can persistently save the corresponding relationship between the name of the web page and the link address of the web page.

[0093] Step S22: The server JavaScript script is run through the browser to generate an Http Post request message.

[0094] Exemplarily, the server JavaScript script is sent by the server 12 to the electronic device 11. ​​

[0095] For example, after receiving the document part and the script part of the webpage fed back by the server, the electronic device 11 can parse the document part and the script part of the webpage through the server JavaScript script, so that the webpage can be updated in time.

[0096] It can be understood that when the browser needs to submit form data to the server, an Http Post request message can be generated. For example, after the browser displays the browser homepage, the user can input a keyword in an input box, and click a search button to generate an Http Post request message carrying the keyword. For another example, after the browser displays the browser homepage, the user can be required to log in, and the user can input a username and a password in the browser homepage to generate an Http Post request message carrying the username and the password.

[0097] In an optional implementation, in the process of running the server JavaScript script, an Http Post request message can be generated through an Ajax (Asynchronous JavaScript and XML) event.

[0098] Step S23: intercepting the Http Post request message from the server JavaScript script through the injected JavaScript script in the browser.

[0099] In the embodiments of the present application, the injected JavaScript script in the browser is referred to as an injected JavaScript script.

[0100] The injected JavaScript script is created through the JavaScript language.

[0101] For example, the injected JavaScript script actually adds a script child element to the head element in the browser. For example, <script>function test(){return"注入脚本测试";}< / script> .

[0102] It can be understood that after the server JavaScript script generates the Http Post request message, the server JavaScript script sends the Http Post request message to the WKwebview control. In order to prevent the server JavaScript script from sending the Http Post request message to the WKwebview control, it is necessary to inject a JavaScript script to monitor the server JavaScript script. After monitoring that the server JavaScript script generates the Http Post request message, the Http Post request message is intercepted before being sent to the WKwebview control.

[0103] When the server JavaScript script detects that the Http Post request message has been intercepted, the server JavaScript script will not send the Http Post request message to the WKwebview control, thereby achieving the purpose of avoiding the WKwebview control from sending the Http Post request message to the server.

[0104] In an optional implementation, a Hook hook function can be set in the injected JavaScript script to monitor whether the server JavaScript script generates the Http Post request message.

[0105] Step S24: sending the Http Post request message to the application program through the injected JavaScript script.

[0106] In an optional implementation, a message channel between the application program and the injected JavaScript script can be constructed in advance, and then the injected JavaScript script sends the Http Post request message to the application program through the message channel.

[0107] For example, a Swift component can be set in the application program, and a message channel between the Swift component and the injected JavaScript script can be constructed in advance, so that the injected JavaScript script sends the Http Post request message to the Swift component through the message channel.

[0108] The Swift component is described below. For example, the Swift component includes:

[0109] Proxy Server: the injected JavaScript script and the server 12 respectively provide object service API (Application Programming Interface), thereby establishing a message channel with the injected JavaScript script and enabling the application to interact with the server.

[0110] The Swift component is created by Swift language.

[0111] Step S25: sending the Http Post request message to the server through the application.

[0112] For example, the Swift component in the application can be used to send the Http Post request message to the server.

[0113] Step S26: sending the data packet fed back by the server in response to the Http Post request message to the injected JavaScript script through the application.

[0114] For example, the server 12 can send the data packet to the Swift component in the application; the Swift component sends the data packet to the injected JavaScript script through the message channel.

[0115] Step S27: sending the data packet to the server JavaScript script through the injected JavaScript script.

[0116] Step S28: rendering and displaying the webpage by the server JavaScript script using the data packet.

[0117] In the webpage display method provided in this application embodiment, since the request content in the HTTP POST request message sent to the server through the WKwebview control is lost after the protocol proxy component is registered in the application, the server cannot respond to the HTTP POST request message normally. Based on this, this application intercepts the HTTP POST request message generated by the server JavaScript script through JavaScript injection in the browser, so as to prevent the server JavaScript script from sending the generated HTTP POST request message to the WKwebview control; the injected JavaScript script sends the HTTP POST request message to the application; the application sends the HTTP POST request message to the server; the data packet returned by the server in response to the HTTP POST request message is also transmitted to the server JavaScript script through the application and the injected JavaScript script, so that the server JavaScript script can render and display the webpage based on the data packet. Thus, the normal display of the webpage is achieved.

[0118] The following describes the method used in this application to download videos from web pages.

[0119] like Figure 4 The diagram shows a flowchart of a method for downloading videos from a webpage according to an embodiment of this application. This method can be applied to an electronic device 11, and the implementation of this method involves the following steps S41 to S44.

[0120] Step S41: Send the data packet to the protocol proxy component in the application via the Swift component.

[0121] For example, the protocol proxy component is a URL (Uniform Resource Locator) Protocol custom protocol proxy component.

[0122] For example, the data packets returned by the server are HTTP (Hypertext Transfer Protocol) data packets.

[0123] Step S42: Obtain the HTTP GET data packet from the data packet through the protocol proxy component.

[0124] In one optional implementation, target data packets with defined fields are filtered from the data packets; the target data packets are determined to be HTTP GET data packets.

[0125] For example, the setting field can be "Get".

[0126] The above process is illustrated by taking the following data packet as an example:

[0127] Suppose the server feedback http data packet is as follows:

[0128] Hypertext Trahster Protocol

[0129] GET http: / / 122.225.117.12 / 197111e76024 / 020064010049D40EDDEAA60097E12DB709D393-364A-0F80-2720-C0B4ED5E2399.flv HTTP / 1.1\r\n

[0130] Request Method: GET

[0131] Request URI http: / / 122.225.117.12 / 197111e76024 / 020064010049D40EDDEAA60097E12DB709D393-364A-0F80-2720-C0B4ED5E2399.flv

[0132] Request Version: HTTP / 1.1

[0133] Accept: * / *\r\n

[0134] Accept-language: zh-CN\r\n

[0135] Referer: http: / / static.youku.com / v 1.0.0025 / v / swf / qplayer.swf\r\n

[0136] x-flash-version: 10,0,22,87\r\n

[0137] ACCEPT-Encoding: gzip,deflate\r\n

[0138] Further filtering the above http data packet, the http get data packet containing the set field "Get" is as follows:

[0139] GET http: / / 122.225.117.12 / 197111e76024 / 020064010049D40EDDEAA60097E12DB709D393-364A-0F80-2720-C0B4ED5E2399.flv HTTP / 1.1

[0140] Request Method: GET

[0141] Request URI http: / / 122.225.117.12 / 197111e76024 / 020064010049D40EDDEAA60097E12DB709D393-364A-0F80-2720-C0B4ED5E2399.flv

[0142] Request Version: HTTP / 1.1

[0143] Step S43: filtering out the link address with the video identifier from the Http Get data packet by the protocol agent component.

[0144] It can be understood that since the format of the video in the webpage can be flv format, MP3 format, MP4 format, MPEG format, MPG format, DAT format, AVI format, MOV format, ASF format, WMV format, M3U8 format, etc., the suffix of the URL in the Http Get data packet is any one of ".flv", ".mp3", ".mp4", ".mpeg", ".mpg", ".dat", ".avi", ".mov", ".wmv", ".m3u8", so the URL can be considered as the link address of the video, since the format of the video can be enumerated, so the suffix of the link address of the video can also be enumerated, so the suffix of the link address of the video can be taken as the video identifier.

[0145] Still taking the above as an example, the link address with the video identifier filtered out from the Http Get data packet is: http: / / 122.225.117.12 / 197111e76024 / 020064010049D40EDDEAA60097E12DB709D393-364A-0F80-2720-C0B4ED5E2399.flv.

[0146] Step S44: downloading the video through the link address.

[0147] The video in M3U8 format has an index video list. When downloading or playing the video in M3U8 format, the index video list needs to be opened, and a plurality of video link addresses are found according to the link addresses of the videos contained in the index video list. If the video in the webpage is in M3U8 format, the link address with the video identifier is filtered out from the Http Get data packet as the address of the index video list.

[0148] In an optional implementation, the specific implementation of step S44 includes the following steps B11 to B14.

[0149] Step B11: whether the video suffix identifier in the link address represents that the video is in M3U8 format, if yes, step B12 is performed, and if no, step B14 is performed.

[0150] Step B12: obtaining an index video list through the link address, the index video list including a plurality of video link addresses.

[0151] Step B13: downloading videos through the plurality of video link addresses contained in the index video list.

[0152] For example, a plurality of videos can be stored in the same folder.

[0153] Step B14: downloading the video through the link address.

[0154] In the embodiment, since the Swift component in the application program can obtain the data packet fed back by the server, the Swift component can send the data packet to the protocol agent component in the application program. The protocol agent component obtains the Http Get data packet from the data packet, filters out the link address with the video identifier from the Http Get data packet, and downloads the video through the link address. Thus, the downloading of the video in the webpage is realized.

[0155] In an optional implementation, as shown in Figure 5 , a schematic diagram of an implementation of the webpage provided by the embodiment is shown.

[0156] As shown in Figure 5 , a sniffing download button can also be displayed on the webpage. Figure 5 Only for example, the shape and position of the sniffing download button in the webpage are not limited in the application.

[0157] In an optional implementation, if it is detected that the sniffing download button is pressed, the step of downloading the video through the link address is performed.

[0158] It can be understood that if the user presses the sniffing download button, it indicates that the user has the demand to download the video in the webpage, and thus the step of downloading the video through the link address can be executed.

[0159] In an optional implementation, after detecting the link address of the video in the webpage, the step of downloading the video through the link address is automatically executed.

[0160] It can be understood that the video in the webpage can be downloaded in advance, and if the user has the demand to download the video in the webpage, the video is directly fed back to the user.

[0161] In an optional implementation, in order to prompt the user that the video in the webpage can be downloaded, after detecting the link address of the video in the webpage, a prompt information is generated, and the prompt information is used to prompt the user that the video in the webpage can be downloaded.

[0162] For example, the prompt information can be to change the appearance of the sniffing download button, such as changing the shape, color and / or size of the sniffing download button.

[0163] For example, the prompt information can be voice prompt information.

[0164] The method is described in detail in the embodiments of the present application, and the method of the present application can be implemented in various forms of devices, and thus the present application also discloses a device, and specific embodiments are given below to be described in detail.

[0165] As shown in Figure 6 FIG. 1 is a structural diagram of a webpage display device provided by an embodiment of the present application, which comprises a starting module 61, a generating module 62, an acquiring module 63, a first sending module 64, a second sending module 65, a third sending module 66, a fourth sending module 67 and a display module 68, wherein:

[0166] The starting module 61 is used to open a browser built in an application through the application under the condition that a webpage loading instruction is received;

[0167] The generating module 62 is used to run a server JavaScript script through the browser to generate an Http Post request message;

[0168] The acquiring module 63 is used to intercept the Http Post request message from the server JavaScript script through an injection JavaScript script in the browser;

[0169] The first sending module 64 is used to send the Http Post request message to the application through the injection JavaScript script.

[0170] The second sending module 65 is configured to send the Http Post request message to the server through the application program;

[0171] The third sending module 66 is configured to send a data packet fed back by the server in response to the Http Post request message to the injected JavaScript script through the application program;

[0172] The fourth sending module 67 is configured to send the data packet to the server JavaScript script through the injected JavaScript script;

[0173] The display module 68 is configured to render and display a webpage by using the data packet through the server JavaScript script.

[0174] In an optional implementation, the first sending module is specifically configured to send the Http Post request message to a Swift component in the application program by using a message channel between the injected JavaScript script and the Swift component constructed in advance;

[0175] In an optional implementation, the method further includes:

[0176] The fifth sending module is configured to send the data packet to a protocol proxy component in the application program through the Swift component;

[0177] The second obtaining module is configured to obtain an Http Get data packet from the data packet through the protocol proxy component;

[0178] The screening module is configured to screen out a link address with a video identifier from the Http Get data packet through the protocol proxy component;

[0179] The downloading module is configured to download a video through the link address.

[0180] In an optional implementation, the downloading module includes:

[0181] The first obtaining unit is configured to obtain an index video list through the link address if a video suffix identifier in the link address represents that the video belongs to an M3U8 format, the index video list including a plurality of video link addresses;

[0182] The downloading unit is configured to download videos respectively through the video link addresses contained in the index video list.

[0183] In an optional implementation, the webpage displays a sniffing download button, and the method further includes:

[0184] The generating module is configured to generate a prompt information if it is detected that the link address of the video in the webpage is acquired, the prompt information being used to prompt that the user can download the video in the webpage.

[0185] The triggering module is configured to trigger the downloading module if it is detected that the sniffing download button is pressed.

[0186] In an optional implementation, the acquiring module includes:

[0187] The monitoring unit is configured to monitor whether the server JavaScript script generates the Http Post request message through the Hook hook function in the injected JavaScript script.

[0188] The second acquiring unit is configured to acquire the Http Post request message from the server JavaScript script if the Hook hook function in the injected JavaScript script monitors that the server JavaScript script generates the Http Post request message.

[0189] In an optional implementation, the starting module includes:

[0190] The calling unit is configured to call the WKwebview component if the application process of the application receives a webpage loading instruction.

[0191] The starting unit is configured to open the browser through the WKwebview component.

[0192] As to the apparatus in the above-mentioned embodiments, the specific manners in which various modules perform operations have been described in details in the embodiments about the method, and will not be described in details here.

[0193] Figure 7 is a block diagram of an electronic device according to an example embodiment. As shown in Figure 7 the electronic device 11 includes, but is not limited to, an input unit 701, a memory 702, a display unit 703, a processor 705, and the like. Those skilled in the art can understand that Figure 7 the structure shown in the above-mentioned embodiment is only an example of implementation, and does not limit the electronic device, and the electronic device can include more or less components than the diagram, or combine certain components, or different component arrangement.

[0194] The following will be described in detail Figure 7 The various components of the electronic device will be described in detail:

[0195] By way of example, the input unit 701 can be used to receive information or character information input by a user, and to generate key signal input with respect to the user's setting of functions provided by the electronic device 11 and the like. The input unit 701 can include, for example, a touch panel 7012 and other input devices 7011. The touch panel 7012, which is also called a touch screen, can collect touch operations (e.g., operations by a user's finger, a stylus, or any other suitable object or accessory) on or near the touch panel 7012, and can drive a corresponding connection device according to a pre-set program. The touch panel 7012 can include, for example, a touch detecting device and a touch controller. The touch detecting device can detect a user's touch position and can detect a signal resulting from the touch operation, and can transmit the signal to the touch controller. The touch controller can receive touch information from the touch detecting device, and can convert the touch information into touch coordinates, and can transmit the touch coordinates to the processor 705. The touch controller can also receive commands from the processor 705 and can execute the commands. The touch panel 7012 can be implemented using, for example, a resistive type, a capacitive type, an infrared type, a surface acoustic wave type, or the like. In addition to the touch panel 7012, the input unit 701 can include other input devices 7011. For example, the other input devices 7011 can include one or more of, for example, a physical keyboard, a function key (e.g., a volume control button, a switch button, or the like), a trackball, a mouse, a joystick, or the like.

[0196] The memory 702 can be used to store software programs and modules, and the processor 705 can execute various functions of the electronic device 11 and data processing by running the software programs and modules stored in the memory 702. The memory 702 can include, for example, a program storage area and a data storage area. The program storage area can store, for example, an operating system, at least one application program required for a function, and the like. The data storage area can store, for example, data created according to the use of the electronic device 11. The memory 702 can include, for example, a high-speed random access memory, and can further include a non-volatile memory such as at least one of a magnetic disk storage device, a flash memory device, or other non-volatile solid state storage device.

[0197] Optionally, the display unit 703 can be used to display information input by the user or information provided to the user (such as a webpage) and various menus of the electronic device 11. The display unit 703 can include a display panel 7031, which can be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, a touch panel 7012 can cover the display panel 7031, and when the touch panel 7012 detects a touch operation thereon or nearby, it transmits to the processor 705 to determine the type of touch event, and then the processor 705 provides corresponding visual output on the display panel 7031 according to the type of touch event. Although in the above embodiment, the touch panel 7012 and the display panel 7031 are implemented as two independent components to realize the input and output functions of the electronic device 11, in some embodiments, the touch panel 7012 and the display panel 7031 can be integrated to realize the input and output functions of the electronic device 11. Figure 7

[0198] Optionally, the processor 705 is the control center of the electronic device 11, which connects various parts of the entire electronic device through various interfaces and lines, and performs various functions of the electronic device 11 and processes data by running or executing software programs and / or modules stored in the memory 702 and calling data stored in the memory 702, thereby overall monitoring the electronic device 11. Optionally, the processor 705 can include one or more processing units; preferably, the processor 705 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 705.

[0199] The electronic device 11 further includes a power supply 704 (such as a battery) for supplying power to various components, and preferably, the power supply can be logically connected to the processor 705 through a power management system, so as to realize the functions of managing charging, discharging, and power consumption management through the power management system.

[0200] Although not shown, the electronic device 11 can further include a camera, a Bluetooth module, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi (wireless fidelity) module, a sensor, a network unit, an interface unit, and the like.

[0201] The electronic device provides the user with wireless broadband Internet access through the network unit, such as accessing a server.

[0202] ​The interface unit is an interface for connecting an external device to the electronic device 11. For example, the external device can include a wired or wireless headset port, an external power (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input / output (I / O) port, a video I / O port, an earphone port, and the like. The interface unit can be used to receive input (e.g., data information, power, and the like) from the external device and transmit the received input to one or more elements within the electronic device 11 or can be used to transmit data between the electronic device 11 and the external device.

[0203] In the embodiment of the present application, the processor 705 included in the electronic device 11 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present application.

[0204] The processor 705 included in the electronic device 11 has the following functions: in the case of receiving a webpage loading instruction, opening a browser embedded in an application through the application; running a server JavaScript script through the browser to generate an Http Post request message; intercepting the Http Post request message from the server JavaScript script through an injected JavaScript script in the browser; sending the Http Post request message to the application through the injected JavaScript script; sending the Http Post request message to the server through the application; sending a data packet fed back by the server in response to the Http Post request message to the injected JavaScript script through the application; sending the data packet to the server JavaScript script through the injected JavaScript script; and rendering and displaying a webpage using the data packet through the server JavaScript script.

[0205] In the exemplary embodiment, the embodiment of the present disclosure also provides a storage medium including instructions, for example, a memory 702 including instructions, which can be executed by the processor 705 of the electronic device 11 to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, and the like.

[0206] In an example embodiment, the present disclosure also provides a computer program product comprising one or more instructions executable by the processor 705 of the electronic device 11 to perform the above method.

[0207] It should be noted that the instructions in the above storage medium or the one or more instructions in the computer program product are executed by the processor 705 to implement each process of the above method embodiment, and the same technical effects can be achieved, and thus will not be described here.

[0208] It should be noted that each embodiment in the present specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between each embodiment can be referred to each other.

[0209] The above description of the disclosed embodiments enables a person skilled in the art to implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method of displaying a web page, characterized by, The webpage display method applied to an iOS operating system comprises: In the case of receiving a webpage loading instruction, opening a browser embedded in an application through the application; Running a server JavaScript script through the browser to generate an Http Post request message; Intercepting the Http Post request message from the server JavaScript script through an injected JavaScript script in the browser to avoid the server JavaScript script from sending the generated Http Post request message to a WKwebview control; Sending the Http Post request message to the application through the injected JavaScript script; Sending the Http Post request message to the server through the application; Sending a data packet fed back by the server in response to the Http Post request message to the injected JavaScript script through the application; Sending the data packet to the server JavaScript script through the injected JavaScript script; Rendering and displaying a webpage through the server JavaScript script using the data packet; The step of sending the Http Post request message to the application through the injected JavaScript script comprises: Sending the Http Post request message to a Swift component in the application through a message channel between the injected JavaScript script and the Swift component using a pre-constructed Swift component; The step of sending the Http Post request message to the server through the application comprises: Sending the Http Post request message to the server through the Swift component in the application.

2. The web page display method of claim 1, wherein, Further comprising: Sending the data packet to a protocol proxy component in the application through the Swift component; Obtaining an Http Get data packet from the data packet through the protocol proxy component; Filtering out a link address with a video identifier from the Http Get data packet through the protocol proxy component; Downloading a video through the link address.

3. The web page display method of claim 2, wherein, The step of downloading a video through the link address comprises: If a video suffix identifier in the link address represents that the video belongs to an M3U8 format, obtaining an index video list through the link address, the index video list comprising a plurality of video link addresses; Downloading videos through the plurality of video link addresses contained in the index video list respectively.

4. The web page display method of claim 2, wherein, The webpage displays a sniffing download button, and further comprises: If it is detected that a link address of a video in the webpage is obtained, generating a prompt information, the prompt information being used to prompt a user that the video in the webpage can be downloaded; If it is detected that the sniffing download button is pressed, executing the step of downloading a video through the link address.

5. The web page display method of claim 1, wherein, The intercepting the Http Post request message from the server JavaScript script by the injected JavaScript script in the browser comprises: monitoring whether the server JavaScript script generates the Http Post request message by a Hook function in the injected JavaScript script; if the Hook function in the injected JavaScript script monitors that the server JavaScript script generates the Http Post request message, obtaining the Http Post request message from the server JavaScript script.

6. The web page display method of claim 1, wherein, The opening the browser in the application by the application in the case of receiving a webpage loading instruction comprises: if the application process of the application receives a webpage loading instruction, calling a WKwebview component; opening the browser by the WKwebview component.

7. A web page display device, characterized by comprising: comprises: a starting module, configured to open the browser in the application by the application in the case of receiving a webpage loading instruction; a generating module, configured to generate a Http Post request message by a server JavaScript script running in the browser; an obtaining module, configured to intercept the Http Post request message from the server JavaScript script by an injected JavaScript script in the browser, so as to avoid the server JavaScript script from sending the generated Http Post request message to a WKwebview control; a first sending module, configured to send the Http Post request message to the application by the injected JavaScript script; a second sending module, configured to send the Http Post request message to the server by the application; a third sending module, configured to send a data packet fed back by the server in response to the Http Post request message to the injected JavaScript script by the application; a fourth sending module, configured to send the data packet to the server JavaScript script by the injected JavaScript script; a display module, configured to render and display a webpage by the server JavaScript script using the data packet; wherein the first sending module comprises: sending the Http Post request message to a Swift component in the application by the injected JavaScript script using a message channel between the injected JavaScript script and the Swift component; the sending the Http Post request message to the server by the application comprises: The Http Post request message is sent to the server by a Swift component in the application program.

8. An electronic device, comprising: Comprise: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the web page display method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the web page display method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for acquiring audio / video link address in webpage

    CN102360349A

  • A data processing method for embedding an iOS App into an HTML5 interface

    CN109947424A

  • Method for improving test efficiency of Web application interface

    CN112241371A

  • WKWebview component network request takeover method and system

    CN112929447A