Page loading method and device, electronic equipment and storage medium
By creating an extended control object compatible with the interface of the control to be called, and resolving its calling behavior as a loading instruction for page metadata, the problem of browsers being unable to load pages containing specific controls is solved, thereby improving browser compatibility and loading efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 龙芯中科(合肥)技术有限公司
- Filing Date
- 2025-12-12
- Publication Date
- 2026-05-05
AI Technical Summary
In existing technologies, browsers cannot properly load pages containing specific controls, leading to compatibility issues. Furthermore, developing webpage versions suitable for different browser engines is time-consuming, labor-intensive, and costly, and may result in poor control compatibility.
By creating an extended control object that is compatible with the interface of the control to be called, the calling behavior of the control to be called is parsed into a page metadata loading instruction, realizing semantic-level replacement. The extended control object is then used to respond to the call request and load the corresponding page metadata to complete the page rendering.
Even when browsers cannot natively support certain preset control types, the page loads normally, improving browser compatibility and loading efficiency while maintaining the stability of the original execution logic of the page source code.
Smart Images

Figure CN121980100A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of Internet technology, specifically relating to a page loading method, device, electronic device, and storage medium. Background Technology
[0002] Accessing web pages via a browser is a crucial part of internet technology. As internet technology continues to evolve, browsers are constantly being updated to meet increasingly diverse user and security needs. Some web pages use controls that are only compatible with specific browsers, which may cause compatibility issues when accessing these pages in other incompatible browsers.
[0003] In existing technologies, webpage versions adapted for different browser engines are typically developed on the business side, ensuring that the webpage only contains control types natively supported by the corresponding browser engine. When a user accesses the webpage through a browser, the business side selects the appropriate webpage version based on the user's browser engine and sends it back to the user so that the user's browser can load and display the webpage correctly.
[0004] However, developing webpage versions compatible with different browser engines is not only time-consuming and labor-intensive, but also may result in the business side only being able to provide users with page source code containing controls that are incompatible with the user's browser engine due to cost factors and lack of maintenance. As a result, there may still be poor compatibility between the user's browser and the controls in the page that need to be accessed, causing the page to fail to load normally. Summary of the Invention
[0005] The purpose of this invention is to provide a page loading method, apparatus, electronic device, and storage medium that can solve the problem in the prior art where pages containing specific controls cannot be loaded normally.
[0006] In a first aspect, embodiments of the present invention provide a page loading method, the method comprising: The control to be invoked is determined from the page source code based on the preset control type. The control to be invoked is incompatible with the browser kernel that displays the page to be loaded. Create an extended control object that is compatible with the interface of the control to be called, wherein the extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction, so as to realize the semantic-level replacement of the function of the control to be called; During the execution of the page source code, the extended control object is used to respond to the call request for the control to be called, and the corresponding page metadata is loaded based on the call request to complete the page rendering.
[0007] Secondly, embodiments of the present invention provide a page loading device, the device comprising: The determination module is used to determine the control to be invoked from the page source code, wherein the control to be invoked is incompatible with the browser kernel that displays the page to be loaded; A creation module is used to create an extended control object that is compatible with the interface of the control to be called. The extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction, so as to realize the semantic-level replacement of the function of the control to be called. The loading module is used to respond to the call request for the control to be called by the extended control object during the execution of the page source code, and load the corresponding page metadata based on the call request to complete the page rendering.
[0008] Thirdly, embodiments of the present invention provide an electronic device, which includes a processor and a memory, wherein the memory stores a program or instructions that can run on the processor, and the program or instructions, when executed by the processor, implement the above-described page loading method.
[0009] Fourthly, embodiments of the present invention provide a readable storage medium on which a program or instruction is stored, and when the program or instruction is executed by a processor, the above-described page loading method is implemented.
[0010] In this embodiment of the invention, a page loading method is provided, comprising: determining a control of a preset control type to be called from the page source code; creating an extended control object compatible with the interface of the control to be called; wherein the extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction, so as to realize semantic-level replacement of the function of the control to be called; and responding to the calling request initiated by the control to be called during the execution of the page source code through the extended control object to load the page corresponding to the page metadata and complete page rendering. When a control of a preset control type exists in the page source code, an extended control object is loaded to replace the control to be called. This allows the local browser to replace controls that are not natively supported by the local browser during the loading of the page source code, enabling the local browser to load page source code containing the preset control type normally, thus solving the problem that browsers cannot load pages containing specific controls normally. Attached Figure Description
[0011] Figure 1 This is a flowchart of the steps of a page loading method provided in an embodiment of the present invention; Figure 2 This is an example diagram of a page loading process including an ActiveX control provided by an embodiment of the present invention; Figure 3 This is a block diagram of a page loading device provided in an embodiment of the present invention; Figure 4 This is an electronic device provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0012] The page loading method provided by the embodiments of the present invention will be described in detail below with reference to the accompanying drawings, through specific examples and application scenarios. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0013] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, the first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In embodiments of this invention, the term "multiple" refers to two or more, and other quantifiers are similar.
[0014] Reference Figure 1 , Figure 1 A flowchart illustrating the steps of a page loading method provided by an embodiment of the present invention is shown, as follows: Figure 1 As shown, the specific steps include: Step 101: Determine the control to be invoked from the page source code, which is of a preset control type and is incompatible with the browser kernel that displays the page to be loaded.
[0015] In this embodiment of the invention, when an electronic device accesses a webpage through a browser, the browser downloads the webpage's source code and renders the page seen by the end user based on the source code. The source code refers to all the code text that constitutes the webpage, and its components may include, but are not limited to, HyperText Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript code. The content of this source code defines the structure, appearance, and behavior of the webpage. A page refers to the web page displayed in the browser.
[0016] The page source code may include controls of a preset control type to be called. This preset control type may include, but is not limited to, ActiveX, Flash, and NPAPI types, which are control types that can only run on specific browser engines. For example, ActiveX controls are reusable software components based on Microsoft's Component Object Model (COM) technology, primarily used to enhance the functionality of web pages or desktop applications, thereby enabling complex interactive functions on the page, such as multimedia playback, data processing, and chart display. ActiveX controls are primarily designed for the Internet Explorer browser engine. Due to security and cross-platform compatibility issues, modern browser engines (such as Chromium-based Google Chrome and Microsoft Edge) no longer support ActiveX controls. Flash controls are based on Adobe Flash technology (ActionScript runtime + SWF rendering engine), belonging to a type of rich media component that can be embedded in web pages or desktop applications. They are mainly used to implement complex functions such as animation display, interactive games, multimedia playback, online educational courseware, and visual presentations on the page, and are widely used in the Web 2.0 era. Due to frequent security vulnerabilities, high performance overhead, and poor mobile compatibility, modern mainstream browsers (such as Chrome, Edge, Firefox, and Safari) completely stopped supporting Flash controls in 2020; details will not be elaborated here.
[0017] In this embodiment of the invention, the control to be called of the preset control type can refer to a control of the preset control type that needs to be called when loading the page corresponding to the page source code. The control to be called of the preset control type can be identified from the page source code during the page source code parsing stage.
[0018] For example, when the preset control type is ActiveX, the web client (e.g., a Chromium-based browser) can respond to the user's input access domain name, establish a network connection with the web server based on the access domain name, and then obtain the corresponding page resources from the web server. It can parse the page source code (e.g., an HTML document) in the page resources, identify the ActiveX controls in the HTML document, and thus determine the control to be called in the page source code.
[0019] When a page loads, this embodiment of the invention obtains the source code content of the target page, which can be achieved through the following methods: HTML files loaded by the browser, page fragments returned by Ajax requests, or template files loaded by the local application rendering engine. The control type, control interface, and control parameters are identified through DOM parsing or regular expression parsing.
[0020] Taking ActiveX controls as an example, it was detected that... Control type: ActiveX type; Control interface: Defined by the control corresponding to the classid; List of control parameter tags (param).
[0021] Based on the above identification information, the control type is determined to be a preset control type that needs to be replaced.
[0022] When it is determined that a control type is a preset control type and needs to be replaced, the original control interface structure is identified. The control call structure is extracted from the page source code, including: control method list, control properties, and control events.
[0023] Identification methods include, but are not limited to: identifying method definitions through pre-built control description files (such as XML and JSON), automatically inferring the control's interface through call relationships in the page script, or establishing an interface model through a historical compatibility library.
[0024] Finally, an interface definition structure is generated, providing a basis for the creation of subsequent extended control objects.
[0025] It should be noted that the process of identifying the controls to be called in the page source code in this embodiment of the invention can occur during the page loading stage, that is, the page can be loaded while the controls to be called are being parsed and identified; or it can occur before the page loading stage, that is, all the controls to be called in the page source code can be identified first, and then the page can be loaded according to the page source code.
[0026] Step 102: Create an extended control object that is compatible with the interface of the control to be called. The extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction, so as to realize the semantic-level replacement of the function of the control to be called. In this embodiment, the system constructs an "Extended Control Object" (ECO) for the control to be invoked identified in the page source code. This object possesses the same interface capabilities as the original control and can perform semantic parsing of the invocation behavior and output page loading instructions. Before constructing the Extended Control Object, the system first analyzes the interface capabilities of the control to be invoked, specifically including: parsing the control's public method set (such as load(), play(), open()), public attributes (such as src, width, status), and events triggered by the control (such as onLoad, onError); the parsing result forms an internal interface description model (Interface Descriptor) and is stored in the form of a data structure. This model provides an interface framework for the construction of the Extended Control Object.
[0027] Extended control objects are only responsible for generating instructions, not for final rendering, thus maintaining a modular design. Through the above steps, extended control objects achieve the following core functions: functionally replacing unusable controls (such as Flash / ActiveX), equivalently transforming control call behavior into page loading behavior, being transparent to page scripts without modifying page source code, and achieving language- and platform-independent migration and replacement through semantic recognition of the original control behavior. Specifically: The system dynamically or statically generates extended control objects based on the interface description model described above, and generates proxy functions for each method as follows: function play() { handleCall("play", arguments)} function open(url) { handleCall("open", [url])} All calls will be uniformly delegated to the internal semantic parsing module. Getters / setters will be generated for each property to capture property access behavior. get src() { return internalState.src} set src(v) { handleCall("setSrc", [v])} The extended control object internally contains a semantic parsing module, which translates control invocation behavior into "page metadata loading instructions." This module outputs a standard loading instruction.
[0028] Step 103: During the execution of the page source code, the extended control object is used to respond to the call request for the control to be called, and the corresponding page metadata is loaded based on the call request to complete the page rendering.
[0029] When page execution code triggers a call request for the control to be invoked, the extended control object will automatically capture this behavior and generate a unified call behavior event structure. The call behavior is then determined to correspond to page loading semantics based on method name mapping rules, parameter pattern matching rules, context rules, or semantic mapping table rules. Specifically, in this embodiment, the method name mapping rule includes mapping a method name to a loading operation if it belongs to the following set: ["open", "load", "play", "show", "render", ...]. The parameter pattern matching rule includes identifying the URL, resource ID, and the data structure bound to the control; if the parameter is a URL, it is mapped to resource page loading; if the parameter is a resource ID, it is mapped to template loading; if the parameter is empty, it is mapped to default template loading. The context rule includes determining the type of page fragment to be loaded based on the DOM node position, control type, and page layout structure at the time of the call. The semantic mapping table rules are maintained by the system using a mapping table, for example: FlashChart.open → Chart H5 Page Template ActiveXVideo.play → Video playback page Old control.upload → HTML template for uploading control When determining the page loading semantics corresponding to the invocation behavior, the invocation request for the control to be invoked can be obtained and processed by the corresponding extended control object through its interface, and the processing result is returned. Other parts of the page source code and other invocation requests can be processed in the conventional way. This embodiment can load an extended control object to replace the control to be invoked when a control of a preset control type exists in the page source code. This allows the local browser to replace controls that are not natively supported by the browser during the page source code loading process, enabling the local browser to load page source code containing preset control types normally, thus solving the problem of browsers being unable to load pages containing specific controls.
[0030] Optionally, the extended control object can be implemented based on an Object element, a script-generated object, or a component instance. In this embodiment of the invention, for controls of a preset control type, corresponding extended Object elements can be set. These extended Object elements can be implemented using a programming language suitable for a browser environment (such as JavaScript). Controls of the preset control type can have different functional types, including but not limited to multimedia playback controls, PDF reader controls, form input controls, etc. Different Object elements can be set for controls of different functional types to achieve different functions.
[0031] In this embodiment of the invention, the extended Object element corresponding to each control to be invoked can be obtained, and then the extended Object element can be loaded to obtain the corresponding extended Object element object. This extended Object element object can also be called an Object element runtime instance. The extended control object implemented based on the Object element is called the extended Object element object.
[0032] The control to be invoked of a preset control type interacts with external programs through an interface. The interface refers to the collection of methods, properties, and events exposed by the control to external programs (such as web pages, applications, scripts, etc.), as well as the format of the data returned in response to the external program's call. In this embodiment of the invention, the extended Object element corresponding to the control of the preset control type has the same interface as the control of the corresponding preset control type. This allows the extended Object element object generated after loading to respond to all calls to the control of the corresponding preset control type and return corresponding return data matching the control of the preset control type to the caller, thereby simulating the control of the corresponding preset control type.
[0033] Web clients (such as Chromium-based browsers) can respond to the domain name entered by the user, establish a network connection with the web server based on the domain name, and then obtain the corresponding page resources from the web server. They can parse the page source code (such as HTML documents) in the page resources, identify ActiveX controls in the HTML document, and thus determine the controls to be called in the page source code.
[0034] For example, if the default control type is ActiveX, the browser parses and identifies the page source code obtained from the web server, and determines that it contains a video player control of ActiveX type (such as Windows Media Player ActiveX Control). Then, the extended Object element corresponding to the video player control can be obtained and the extended Object element can be loaded to create the extended Object element object corresponding to the video player control.
[0035] To improve browser security and page loading efficiency, the aforementioned extended Object elements can be pre-configured in the native browser kernel (e.g., the Chromium kernel). This allows the native browser kernel to directly load the extended Object element object, and the Object element object running within the native browser kernel directly implements the functionality of the corresponding control to be loaded. In this embodiment of the invention, the native browser kernel can refer to a browser kernel that does not natively support the preset control type. For example, when the preset control type is ActiveX, the native browser kernel can be a modern browser kernel that does not natively support ActiveX types.
[0036] In this embodiment of the invention, since an extended Object element object corresponding to the control to be called is created, and the extended Object element object is compatible with the interface of the corresponding control to be called (e.g., having the same interface), during the execution of the page source code, the call request for the control to be called can be obtained and processed by the corresponding interface of the extended Object element object, and the processing result is returned. The extended Object element object can respond to the call request for the control to be called during the execution of the page source code. Other parts of the page source code and other call requests can be processed in the conventional way. Thus, without changing the page source code and the page source code execution logic, the page source code can be successfully executed and the corresponding web page can be loaded on the native browser kernel that cannot natively support the control to be called of the preset control type. This achieves support for the page source code containing the control to be called of the preset control type.
[0037] In this embodiment of the invention, the loading of all extended Object elements corresponding to the controls to be called can be completed before the page source code is executed, thereby improving the execution efficiency of the subsequent page source code. Alternatively, during the execution of the page source code, the extended Object element corresponding to a control to be called can be loaded only when it is needed, thereby enabling the page to start the loading process as soon as possible and reducing page loading delay.
[0038] It is understood that this embodiment mainly uses the extended control object (extended Object element object) implemented based on the Object element as an example for description. The extended control object can also be implemented based on script-generated objects or component instances. The execution process is similar, and will not be described in detail here.
[0039] In summary, the page loading method provided by this invention includes: determining a control of a preset control type to be called from the page source code; creating an extended control object compatible with the interface of the control to be called; wherein the extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction to achieve semantic-level replacement of the function of the control to be called; and responding to the calling request initiated by the control to be called during the execution of the page source code through the extended control object to load the page corresponding to the page metadata and complete page rendering. When a control of a preset control type exists in the page source code, an extended control object is loaded to replace the control to be called. This allows the local browser to replace controls that are not natively supported by the local browser during the page source code loading process, enabling the local browser to load page source code containing the preset control type normally, thus solving the problem of browsers being unable to load pages containing specific controls.
[0040] Furthermore, since the extended control object is compatible with the interface of the control to be called (e.g., the interfaces are the same), the original execution logic of the page source code can be maintained when loading the page based on the page source code, which helps to improve the page loading stability of this solution when it is compatible with the page source code.
[0041] Optionally, in some implementations, the step of determining the control to be invoked from the page source code of a preset control type may specifically include: Step 1011: Identify the control identifier attribute name corresponding to the preset control type from the Object element of the page source code.
[0042] Since controls of the preset control type in the page source code are usually used in an Object element in the page source code, in order to improve the efficiency of identifying the control to be called from the page source code, we can first identify each Object element contained therein during the parsing process of the page source code, and then check from each Object element whether the control to be called uses the preset control type.
[0043] For example, since Object elements in page source code are typically described using Hypertext Markup Language (HTML) and are usually represented by Object element tags (e.g. <object>The Object element is marked, so when parsing the HTML of the page source code, the Object element tag can be identified to determine the Object element in the page source code.
[0044] In this embodiment of the invention, for each Object element in the page source code, the control identifier attribute name corresponding to the preset control type can be identified in the Object element of the page source code. The control identifier attribute name is used to mark the field where the control identifier of the preset control type is located.
[0045] For example, when the preset control type is ActiveX, since the control identifier attribute name corresponding to ActiveX type controls is usually "classid", the "classid" can be identified in the Object element of the page source code to determine the ActiveX type control identifier attribute name. It should be noted that the control identifier attribute name corresponding to different preset control types can be different, and the control identifier attribute name to be matched can also be different depending on the preset control type to be searched.
[0046] Step 1012: Determine the control to be invoked based on the field containing the control identifier attribute name.
[0047] In this embodiment of the invention, after determining the control identifier attribute name corresponding to the preset control type from the page source code, the control identifier can be extracted from the field where the control identifier attribute name is located, and thus the control identifier is the control identifier of the control to be called.
[0048] For example, taking ActiveX as the default control type, the following provides a possible Object element that may appear in the page source code: <object classid="CLSID:XXX-XXX-XX-XX-XXXX" width="400" height="300"> Here, "object" indicates the start of the Object element, "classid" is the control identifier attribute name corresponding to the ActiveX type, and "CLSID:XXX-XXX-XX-XX-XXXX" is the control identifier corresponding to the control to be called. You can first identify "object" to determine the Object element in the page source code, and then detect "classid" from the Object element. If it exists, you can further obtain the control identifier based on the field where "classid" is located, and then determine the control to be called.
[0049] By identifying the control identifier attribute name corresponding to the preset control type from the Object element in the page source code, and determining the control to be invoked based on the field where the control identifier attribute name is located, the efficiency of determining the control to be invoked from the page source code is improved.
[0050] Optionally, in some implementations, the step of determining the control to be invoked from the page source code of a preset control type may specifically include: Step 1013: Obtain the control creation request sent by the control operation interface corresponding to the preset control type during the code execution process in the page source code.
[0051] Besides using controls within their Object elements, page source code can also directly create and use required controls through corresponding control operation interfaces during code execution. Therefore, in this embodiment of the invention, the control operation interfaces corresponding to preset control types can be monitored to obtain control creation requests sent to these interfaces during code execution. The aforementioned code may include JavaScript code or other code used to control the behavior and interaction of the webpage; this embodiment of the invention does not impose specific limitations. These control creation requests can be used to instantiate the corresponding controls to be invoked.
[0052] In this embodiment of the invention, in order to enable native browser kernels that do not natively support preset control types to correctly process control creation requests sent by control operation interfaces corresponding to preset control types, the definition and support for control operation interfaces corresponding to preset control types can be added to the native browser kernel, and the control operation interface can be bound to the extended Object element. This enables the native browser kernel to correctly respond to control creation requests and other requests sent by the control operation interface, thereby supporting control creation requests and other requests initiated by the code in the page source code for the control to be called.
[0053] For example, when the native browser engine is Chromium and the default control type is ActiveX, an interface description for an ActiveXObject can be created in the browser engine using Web Interface Definition Language (WebIDL) technology. This description declares the available methods and binds the declared methods to the interfaces of the corresponding extended Object elements for each ActiveX control. This enables the Chromium engine to support ActiveXObject interface calls initiated from the page source code. Correspondingly, in the page source code, a control creation request for the ActiveX control can be issued using the `newActiveXObject` directive.
[0054] Web Interface Definition Language (WIL) is a language for describing Web APIs. It aims to simplify the implementation of Web APIs and provide an easy-to-understand way of describing them. WIL allows different programming languages to interact, enabling code sharing across different programming languages and platforms and ensuring consistency of Web APIs across various platforms.
[0055] Step 1014: Determine the control to be invoked based on the control creation request.
[0056] In this embodiment of the invention, the control creation request sent to the control operation interface corresponding to the preset control type typically carries a control identifier of the preset type control to be operated. The control creation request can be parsed to obtain the control identifier, which can then indicate the control to be invoked. For example, when the control creation request is newActiveXObject, it may include a programmatic identifier (PROGID) as the control identifier used to indicate the control to be invoked.
[0057] By obtaining control creation requests sent by the control operation interfaces corresponding to preset control types during code execution in the page source code, the system determines the controls to be invoked based on these requests. This allows the identification of controls needed during code execution in the page source code and the recognition of controls used in various ways within the page source code, thus improving the support range for preset control types in the page source code.
[0058] Optionally, in some implementations, the step of creating an extended control object compatible with the interface of the control to be called may specifically include: Step 1021: If the kernel extended Object element library contains the extended Object element corresponding to the control to be called, load the extended Object element to create an extended Object element object; the extended Object element object is an extended control object implemented based on the Object element.
[0059] In this embodiment of the invention, a kernel extension Object element library can be added to the local browser. This library can contain extension Object elements corresponding to one or more preset control types. After identifying the control to be invoked, the kernel extension Object element library can be queried based on the control identifier to find the extension Object element corresponding to the control. Then, the extension Object element corresponding to the control is loaded and instantiated, thereby creating the extension Object element object corresponding to the control.
[0060] Specifically, the correspondence between the element identifiers of all extended Object elements and the control identifiers of corresponding preset control types can be recorded in the local browser. Then, based on the control identifier of the control to be called, the above correspondence can be queried to determine the corresponding element identifier, and the corresponding kernel extended Object element can be obtained from the kernel extended Object element library based on the element identifier.
[0061] In this embodiment of the invention, the loading of extended Object elements can be achieved through internal browser operations. Compared with the method that some preset control types of controls need to be loaded in system files outside the browser (for example, in the case of the preset control type being ActiveX, in order to load the ActiveX control, it is necessary to operate on the system registry), the system security when the browser loads the preset control type of control to be loaded can be significantly improved.
[0062] Step 1022: If the kernel extended Object element library does not contain the extended Object element corresponding to the control to be called, obtain the extended Object element corresponding to the control to be called from the server, load the extended Object element, and create the extended Object element object.
[0063] In this embodiment of the invention, since the preset control type can have a variety of controls with different functions, and the number of pages that need to use the preset control type may be small, and different users have different usage habits, the preset control types used on the pages they visit are relatively fixed, therefore, only a small number of extended Object elements can be preset in the kernel extended Object element library, or no extended Object elements can be preset. This allows the corresponding extended Object element to be obtained from the server even if the kernel extended Object element library does not contain the extended Object element corresponding to the control to be called, and the corresponding extended Object element object can be created based on the extended Object element obtained from the server. It should be noted that the extended Object element obtained from the server can also be installed in the kernel extended Object element library of the local browser kernel.
[0064] This invention enables the retrieval of the extended Object element corresponding to the control to be called from the server, even when the kernel extended Object element library does not contain such an extended Object element, to create an extended Object element object. This allows the native browser to support a large number of preset control types with different functions, while reducing the size of the browser kernel and improving browser installation and running efficiency.
[0065] Optionally, in some implementations, the step of obtaining the extended Object element corresponding to the control to be invoked from the server can be performed in the following manner: Send the control identifier corresponding to the control to be invoked and the kernel identifier corresponding to the local browser kernel to the server, so that the server returns the corresponding extended Object element based on the control identifier and the kernel identifier.
[0066] In this embodiment of the invention, since different users may use various native browser kernels (e.g., different processor architectures, different kernel types, different kernel versions, etc.), the extended Object elements corresponding to the same control adapted by different browser kernels may differ.
[0067] Therefore, in this embodiment of the invention, in order to enable the local browser to obtain extended Object elements with high compatibility, when obtaining extended Object elements from the server, the control identifier corresponding to the control to be called that needs to be compatible, and the kernel identifier corresponding to the local browser kernel, can be sent to the server simultaneously. This allows the server to query the corresponding set of extended Object elements based on the control identifier. An extended Object element set can contain multiple versions of extended Object elements for controls of the same preset control type and for different browser kernels. Then, based on the kernel identifier, the extended Object element suitable for the local browser kernel is selected from the extended Object element set and returned to the user's local browser.
[0068] It should be noted that extended Object elements applicable to different native browser engines may differ in rendering optimization methods, security strategies, and error handling mechanisms in order to better adapt to the corresponding browser engines.
[0069] In this embodiment of the invention, the control identifier corresponding to the control to be called and the kernel identifier corresponding to the local browser kernel can be sent to the server so that the server can return the corresponding extended object element based on the control identifier and the kernel identifier. This not only allows the server to obtain the required extended object element, but also allows the server to obtain an extended object element with higher compatibility with the local browser kernel, which helps to improve the running stability of the local browser kernel.
[0070] Optionally, in this embodiment of the invention, the step of responding to a call request for the control to be called using the extended control object during the execution of the page source code may specifically include: Step 1031: In response to a call request initiated for the control to be called during the execution of the page source code, determine the call category corresponding to the call request; wherein, the call category includes external call and internal call.
[0071] In this embodiment of the invention, during the execution of the page source code, call requests related to the control to be called are initiated, i.e., call requests specifically for the control to be called. These call requests can be distributed into different call categories, specifically including internal calls that need to be processed by the control itself, and external calls that do not require processing by the control itself. Internal calls are typically used to control the internal behavior of the control to be called; for example, in the case of a player control, internal calls could be requests to pause, play, fast forward, etc. External calls are typically used to control the external attributes of the control to be called; for example, in the case of a player control, external calls could be requests to adjust the control's position, style, etc., on the page.
[0072] Specifically, the call category of a call request can be determined based on the call interface corresponding to the call request initiated against the control to be called. The call interface can be matched with the interfaces of the corresponding extended control object (such as an extended Object element object). If the call interface matches one of the interfaces of the corresponding extended Object element object, the call category of the call request can be determined to be an internal call; otherwise, the call category of the call request can be determined to be an external call.
[0073] Step 1032: If the call category of the call request is the internal call, process the call request through the interface of the extended control object.
[0074] In this embodiment of the invention, if the call type of the call request is determined to be an internal call, the call request can be processed and responded to through the interface of the extended control object (such as an extended Object element object). Specifically, the call request can be passed to the extended Object element object for processing through its interface. The interface of the extended Object element object can refer to an interface created using Web Interface Definition Language technology.
[0075] Step 1033: If the call category of the call request is the external call, process the call request through the object element interface of the native browser kernel.
[0076] In this embodiment of the invention, if the call request is determined to be an external call, the request can be processed and responded to through the object element interface of the native browser kernel. The object element interface (HTMLObjectElement API), also known as the Objective element interface, is a widely supported Objective element manipulation interface in modern browsers, capable of manipulating Object elements on a page. In this embodiment, the object element interface allows configuration and manipulation of the external properties of extended Object elements, thereby enabling the processing and response to external calls issued by the corresponding control to be invoked by extending the Objective element object.
[0077] By responding to call requests initiated for the control to be invoked during page source code execution, the call category corresponding to the call request is determined. The call category includes external calls and internal calls. When the call request is an internal call, the call request is handled through the interface of the extended control object (such as an extended Object element object). When the call request is an external call, the call request is handled through the object element interface of the native browser kernel. This allows for the handling of internal and external calls initiated for the control to be invoked during the page source code loading and execution phase within the native browser kernel. This ensures that all types of calls to the control to be invoked can be correctly executed within the native browser kernel, improving the stability of native browser compatibility with the control to be invoked.
[0078] Reference Figure 2 , Figure 2 This diagram illustrates an example of a page loading process including an ActiveX control, as provided in an embodiment of the present invention. Figure 2 As shown, the local browser sends a resource request to the web server to obtain the page source code. It then performs HTML parsing on the source code, identifies the Object element carrying the classid, and parses and executes the JavaScript scripts within the source code, recognizing control creation requests (new ActiveXObject) for ActiveX controls. Based on the Object element carrying the classid and the control creation request, it determines the ActiveX type control to be called by the page source code and loads the corresponding extended Object element, creating the extended Object element object for the control. Subsequently, during the page source code loading phase, it can respond to call requests for the controls during page loading. For external call requests, it handles the response through the native Object element interface supported by the local browser; for internal call requests, it handles the response through the interface of the corresponding extended Object element object, thus completing the page loading process based on the page source code.
[0079] It should be noted that, based on the user's required preset control types and control function types, a corresponding native browser that supports these preset control types and control function types is selected and installed. This allows the native browser kernel to integrate the corresponding extended Object element, enabling compatibility with the user's required preset control types through the extended Object element. For example, a list of control types and a list of control functions can be provided to the user. The browser download server allows the user to select a preset control type from the control type list and a preset control function from the control function list. Based on the user's selected preset control type and preset control function, the browser download server adds the corresponding extended Object element code to the regular browser kernel code and compiles it to obtain the browser installation package that supports the preset control type and preset control function, allowing the user to install the native browser on their local machine. Here, "regular browser kernel" refers to a browser kernel that cannot natively support the user's required preset control type; that is, the control to be called for the preset control type is incompatible with the regular browser kernel. For example, if the preset control type is ActiveX, the regular browser kernel could be the Chromium kernel.
[0080] Optionally, to further improve the convenience for users to obtain browser installation packages and install their native browser, the system can collect the addresses of target pages that need to be compatible. Based on the target page addresses, it can determine the types of preset controls that are not natively supported by modern browser engines, as well as the preset control functions of these preset control types. Based on the preset control types and preset control functions, the system can automatically generate a browser installation package that is compatible with the target page and allows the target page to render and be accessed normally. Users can then install this browser package on their local machine to obtain a native browser, thus enabling normal access to target page addresses that are not natively supported by modern browsers.
[0081] The page loading method provided in this embodiment of the invention can be executed by a page loading device. This embodiment of the invention uses a page loading device executing the page loading method as an example to illustrate the page loading device provided in this embodiment of the invention.
[0082] Reference Figure 3 , Figure 3 This is a block diagram of a page loading device provided in an embodiment of the present invention, such as... Figure 3 As shown, the page loading device 300 includes: The determination module 301 is used to determine the control to be called from the page source code, wherein the control to be called is incompatible with the browser kernel that displays the page to be loaded; The creation module 302 is used to create an extended control object that is compatible with the interface of the control to be called. The extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction, so as to realize the semantic-level replacement of the function of the control to be called. The loading module 303 is used to respond to the call request for the control to be called by the extended control object during the execution of the page source code, and load the corresponding page metadata based on the call request to complete the page rendering.
[0083] Optionally, the extended control object can be implemented based on an Object element, a script-generated object, or a component instance.
[0084] Optionally, the determining module includes: The identification submodule is used to identify the control identifier attribute name corresponding to the preset control type from the Object element of the page source code; The first submodule for control to be invoked is used to determine the control to be invoked based on the field where the control identifier attribute name is located.
[0085] Optionally, the determining module includes: The control creation request submodule is used to obtain control creation requests sent by the control operation interface corresponding to the preset control type during the execution of the code in the page source code; The second submodule for control to be invoked is used to determine the control to be invoked based on the control creation request.
[0086] Optionally, the creation module includes: The first creation submodule is used to load the extended Object element in the kernel extended Object element library, if the extended Object element corresponding to the control to be called is included, to create an extended Object element object; the extended Object element object is an extended control object implemented based on the Object element; The second creation submodule is used to obtain the extended object element corresponding to the control to be called from the server when the kernel extended object element library does not contain the extended object element corresponding to the control to be called, and load the extended object element to create the extended object element object.
[0087] Optionally, the second creation submodule is further configured to send the control identifier corresponding to the control to be invoked and the kernel identifier corresponding to the local browser kernel to the server, so that the server returns the corresponding extended Object element based on the control identifier and the kernel identifier.
[0088] Optionally, the loading module includes: The call category submodule is used to respond to a call request initiated for the control to be called during the execution of the page source code and determine the call category corresponding to the call request; wherein, the call category includes external call and internal call; The first call request processing submodule is used to process the call request through the interface of the extended control object when the call request type is the internal call. The second call request processing submodule is used to process the call request through the object element interface of the native browser kernel when the call request type is the external call.
[0089] Optionally, the preset control type includes ActiveX type.
[0090] In summary, the page loading device provided by this invention includes: a determining module for determining a control of a preset control type to be called from the page source code; a creating module for creating an extended control object compatible with the interface of the control to be called; wherein the extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction to achieve semantic-level replacement of the function of the control to be called; and a loading module for responding to the calling request for the control to be called using the extended control object during the execution of the page source code, and loading the corresponding page metadata based on the calling request to complete page rendering. When a control of a preset control type exists in the page source code, an extended control object for replacing the control to be called can be loaded. This allows the local browser to replace controls that are not natively supported by the local browser during the page source code loading process, enabling the local browser to load page source code containing the preset control type normally, thus solving the problem of browsers being unable to load pages containing specific controls.
[0091] Furthermore, since the extended control object is compatible with the interface of the control to be called (e.g., the interfaces are the same), the original execution logic of the page source code can be maintained when loading the page based on the page source code, which helps to improve the page loading stability of this solution when it is compatible with the page source code.
[0092] The page loading device provided in this embodiment of the invention can achieve Figures 1 to 2 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0093] Optionally, such as Figure 4 As shown, this embodiment of the invention also provides an electronic device M00, including a processor M01 and a memory M02. The memory M02 stores a program or instructions that can run on the processor M01. When the program or instructions are executed by the processor M01, they implement the various steps of the above-described page loading method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0094] It should be noted that the electronic devices in the embodiments of the present invention include the mobile electronic devices and non-mobile electronic devices described above.
[0095] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present invention.
[0096] The electronic device 1000 includes, but is not limited to, the following components: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.
[0097] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0098] The processor 1010 is used to determine the control to be invoked from the page source code, which is of a preset control type; to create an extended Object element object corresponding to the control to be invoked; wherein the extended Object element object has the same interface as the control to be invoked; and to respond to the invocation request initiated for the control to be invoked during the execution of the page source code through the extended Object element object, so as to load the page corresponding to the page metadata.
[0099] In summary, this invention can load an extended control object to replace a pre-defined control type that is to be called in the page source code. This allows the local browser to replace controls that are not natively supported by the browser during the page source code loading process, enabling the browser to load page source code containing pre-defined control types correctly. This solves the problem of browsers being unable to load pages containing specific controls. Because the extended control object is compatible with the interface of the control to be called, the original execution logic of the page source code can be maintained during page loading, which helps improve the stability of page loading when compatible with the page source code.
[0100] It should be understood that, in this embodiment of the invention, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 1007 includes a touch panel 10071 and at least one of other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0101] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or it may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0102] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.
[0103] This invention also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described page loading method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0104] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0105] This invention also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described page loading method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0106] It should be understood that the chip mentioned in the embodiments of the present invention may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0107] This invention provides a computer program product that is stored in a storage medium and executed by at least one processor to implement the various processes of the page loading method embodiment described above, and achieves the same technical effect. To avoid repetition, it will not be described again here.< / object>
Claims
1. A page loading method, characterized in that, The method includes: The control to be invoked is determined from the page source code based on the preset control type. The control to be invoked is incompatible with the browser kernel that displays the page to be loaded. Create an extended control object that is compatible with the interface of the control to be called, wherein the extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction, so as to realize the semantic-level replacement of the function of the control to be called; During the execution of the page source code, the extended control object is used to respond to the call request for the control to be called, and the corresponding page metadata is loaded based on the call request to complete the page rendering.
2. The method according to claim 1, characterized in that, The extended control object can be implemented based on an Object element, a script-generated object, or a component instance.
3. The page loading method according to claim 2, characterized in that, The controls to be invoked, whose preset control types are determined from the page source code, include: Identify the control identifier attribute name corresponding to the preset control type from the Object element of the page source code; The control to be invoked is determined based on the field containing the control's identifier attribute name.
4. The page loading method according to claim 1, characterized in that, The controls to be invoked, whose preset control types are determined from the page source code, include: Obtain the control creation request sent by the control operation interface corresponding to the preset control type during the code execution process in the page source code; The control to be invoked is determined based on the control creation request.
5. The page loading method according to claim 2, characterized in that, The creation of an extended control object compatible with the interface of the control to be called includes: If the kernel extended Object element library contains an extended Object element corresponding to the control to be called, the extended Object element is loaded to create an extended Object element object; the extended Object element object is an extended control object implemented based on the Object element. If the kernel extended Object element library does not contain the extended Object element corresponding to the control to be called, the extended Object element corresponding to the control to be called is obtained from the server, and the extended Object element is loaded to create the extended Object element object.
6. The page loading method according to claim 5, characterized in that, The step of obtaining the extended Object element corresponding to the control to be invoked from the server includes: Send the control identifier corresponding to the control to be invoked and the kernel identifier corresponding to the local browser kernel to the server, so that the server returns the corresponding extended Object element based on the control identifier and the kernel identifier.
7. The page loading method according to claim 1, characterized in that, During the execution of the page source code, responding to a call request for the control to be invoked using the extended control object includes: In response to a call request initiated for the control to be invoked during the execution of the page source code, the call category corresponding to the call request is determined; wherein, the call category includes external call and internal call; If the call request is classified as an internal call, the call request is processed through the interface of the extended control object. When the call request is classified as an external call, the call request is processed through the object element interface of the native browser kernel.
8. The page loading method according to any one of claims 1 to 7, characterized in that, The preset control types include ActiveX types.
9. A page loading device, characterized in that, The device includes: The determination module is used to determine the control to be invoked from the page source code, wherein the control to be invoked is incompatible with the browser kernel that displays the page to be loaded; A creation module is used to create an extended control object that is compatible with the interface of the control to be called. The extended control object is used to parse the calling behavior of the control to be called into a page metadata loading instruction, so as to realize the semantic-level replacement of the function of the control to be called. The loading module is used to respond to the call request for the control to be called by the extended control object during the execution of the page source code, and load the corresponding page metadata based on the call request to complete the page rendering.
10. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions which, when executed by the processor, implement the page loading method of any one of claims 1 to 8.
11. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the page loading method of any one of claims 1 to 8.