CN115904524A - Plug-in compatible method, device and equipment for browser and storage medium - Google Patents
Plug-in compatible method, device and equipment for browser and storage medium Download PDFInfo
- Publication number
- CN115904524A CN115904524A CN202111111168.6A CN202111111168A CN115904524A CN 115904524 A CN115904524 A CN 115904524A CN 202111111168 A CN202111111168 A CN 202111111168A CN 115904524 A CN115904524 A CN 115904524A
- Authority
- CN
- China
- Prior art keywords
- browser
- node
- plug
- page
- dom tree
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000009877 rendering Methods 0.000 claims abstract description 20
- 238000006243 chemical reaction Methods 0.000 claims description 50
- 230000003044 adaptive effect Effects 0.000 abstract description 11
- 238000004891 communication Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 3
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a plug-in compatible method of a browser, when the browser detects a page triggering instruction, a corresponding page to be processed is determined according to the page triggering instruction; acquiring page resources of a page to be processed; acquiring a DOM tree corresponding to the page resource; determining nodes which are not matched with the browser in the DOM tree; replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource; and rendering the adjusted page resource through the browser. The invention also discloses a plug-in compatible device, equipment and a storage medium of the browser. According to the method and the device, the plug-in nodes which are not adaptive to the browser are identified, and the corresponding node information is replaced by the node information which is adaptive to the browser, so that the browser can normally display the display page, the browser is compatible with the active plug-in, and the old system developed based on the active plug-in can be transferred to platforms such as a trusted platform and the like to normally operate.
Description
Technical Field
The present invention relates to the field of plug-in technologies, and in particular, to a plug-in compatibility method, device, apparatus, and storage medium for a browser.
Background
In the field of government and enterprise, multimedia components of a plurality of systems are developed based on an IE browser + active plugin, so that the systems can only run in the environment of the IE browser + active plugin.
However, currently, platforms such as a trusted platform and the like do not have active plug-ins, browsers of the platforms cannot be compatible with the active plug-ins, and therefore when the systems are migrated to the platforms, the systems cannot normally run on the platforms.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a method, a device, equipment and a storage medium for plug-in compatibility of a browser, and aims to realize the compatibility of the browser and an active plug-in.
In order to achieve the above object, the present invention provides a plug-in compatible method for a browser, which comprises the following steps:
when a browser detects a page triggering instruction, determining a corresponding page to be processed according to the page triggering instruction;
acquiring page resources of the page to be processed;
acquiring a DOM tree corresponding to the page resource;
determining nodes which are not adaptive to the browser in a DOM tree;
replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource;
and rendering the adjusted page resources through the browser.
Optionally, the step of determining a node in the DOM tree that is not adapted to the browser includes:
determining a node type corresponding to the DOM tree;
acquiring a preset identifier list corresponding to the node type;
and when the identifier of the node in the DOM tree exists in a preset identifier list corresponding to the node type of the node, taking the node as the node which is not adapted by the browser.
Optionally, the step of determining the node type corresponding to the DOM tree includes:
determining a plurality of nodes in the DOM tree;
determining the priority of a plurality of nodes in the DOM tree;
and taking the node type of the node with the highest priority as the node type corresponding to the DOM tree.
Optionally, the step of determining the priorities of the plurality of nodes in the DOM tree includes:
detecting whether node information of each node in the DOM tree is wrong;
if the node with the wrong node information exists, deleting the node with the wrong node information;
and determining the priorities of a plurality of nodes in the DOM tree after the node with the wrong node information is deleted.
Optionally, after the step of obtaining the preset identifier list corresponding to the node type, the method further includes:
and when the identifier of the node in the DOM tree does not exist in a preset identifier list corresponding to the node type of the node, taking the node as the node which can be adapted by the browser.
Optionally, before the step of replacing the node information of the node that is not adapted to the browser with the node information that is adaptable to the browser, the method further includes:
determining a node type corresponding to the DOM tree;
acquiring a node information conversion rule corresponding to the node type;
and acquiring the node information adaptable to the browser according to the node conversion rule and the node information of the node unsuitable for the browser.
Optionally, the step of obtaining the node information adaptable to the browser according to the node conversion rule and the node information of the node unsuitable to the browser includes:
acquiring each attribute information in the node information of the node which is not adapted to the browser;
acquiring target attribute information corresponding to each attribute information according to the node conversion rule;
and generating node information which can be adapted to the browser according to the target attribute information.
Optionally, the step of obtaining the node information conversion rule corresponding to the node type includes:
determining the plug-in type of the node which is not adapted to the browser;
acquiring a plurality of preset node information conversion rules corresponding to the plug-in type;
and determining a node information conversion rule corresponding to the node type in a plurality of preset node information conversion rules.
Optionally, after the step of obtaining the DOM tree corresponding to the page resource, the method further includes:
and rendering the page resource through the browser when the DOM tree does not have a node which is not adaptive to the browser.
Optionally, after the step of rendering the adjusted page resource through the browser, the method further includes:
displaying the page to be processed according to the display data obtained by rendering;
detecting whether the page to be processed is normally displayed or not;
and when the page to be processed is not normally displayed, returning to execute the step of acquiring the DOM tree corresponding to the page resource.
Optionally, the plug-in compatible method for the browser further includes:
when the browser is installed successfully, acquiring an operation platform where the browser is located;
and when the operating platform is a trusted platform, executing the step of determining the corresponding page to be processed according to the page triggering instruction when the browser detects the page triggering instruction.
Optionally, the plug-in compatible method for the browser further includes:
when detecting that an operating system is migrated to an operating platform where the browser is located, acquiring system information of the operating system;
judging whether the operating system is matched with an operating platform where the browser is located or not according to the system information;
and if not, executing the step of determining the corresponding page to be processed according to the page triggering instruction when the browser detects the page triggering instruction.
In addition, to achieve the above object, the present invention further provides a plug-in compatible device for a browser, including: a memory, a processor and a plug-in compatible program of a browser stored on said memory and executable on said processor, said plug-in compatible program of a browser implementing the steps of the plug-in compatible method of a browser as described in any one of the above when executed by said processor.
In addition, to achieve the above object, the present invention further provides a computer storage medium, on which a plug-in compatible program of a browser is stored, and the plug-in compatible program of the browser implements the steps of the plug-in compatible method of the browser as described in any one of the above when executed by a processor.
In addition, to achieve the above object, the present invention further provides a plug-in compatible device for a browser, where the plug-in compatible device for a browser includes:
the identification module is used for determining a corresponding page to be processed according to a page trigger instruction when the browser detects the page trigger instruction, acquiring page resources of the page to be processed, acquiring a DOM tree corresponding to the page resources, and determining nodes which are not adapted to the browser in the DOM tree;
the replacing module is used for replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource;
and the rendering module is used for rendering the adjusted page resources through the browser.
Optionally, the identifying module is further configured to determine a node type corresponding to the DOM tree, obtain a preset identifier list corresponding to the node type, and use the node as a node that is not adapted to the browser when the identifier of the node in the DOM tree exists in the preset identifier list corresponding to the node type of the node.
Optionally, the identifying module is further configured to determine a plurality of nodes in the DOM tree, determine priorities of the plurality of nodes in the DOM tree, and use a node type of a node with a highest priority as a node type corresponding to the DOM tree.
Optionally, the plug-in compatible device for the browser further includes:
the acquisition module is used for determining the node type corresponding to the DOM tree, acquiring the node information conversion rule corresponding to the node type, and acquiring the node information adaptable to the browser according to the node conversion rule and the node information of the node unsuitable for the browser.
Optionally, the obtaining module is further configured to obtain each attribute information in the node information of the node that is not adapted to the browser, obtain target attribute information corresponding to each attribute information according to the node conversion rule, and generate node information that is adapted to the browser according to the target attribute information.
Optionally, the identification module is further configured to, when detecting that the operating system migrates to the operating platform where the browser is located, obtain system information of the operating system, determine whether the operating system is matched with the operating platform where the browser is located according to the system information, and if not, execute the step of determining the corresponding to-be-processed page according to the page trigger instruction when the browser detects the page trigger instruction.
According to the plug-in compatible method, device, equipment and storage medium of the browser provided by the embodiment of the invention, when the browser detects a page trigger instruction, a corresponding page to be processed is determined according to the page trigger instruction; acquiring page resources of a page to be processed; acquiring a DOM tree corresponding to the page resource; determining nodes which are not matched with the browser in the DOM tree; replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource; and rendering the adjusted page resources through the browser. According to the method and the system, the plug-in nodes which are not adapted to the browser are identified, and the corresponding node information is replaced by the node information which is adapted to the browser, so that the browser can normally display the display page, the compatibility of the browser and the active plug-in is realized, and the normal operation of an old system developed based on the active plug-in can be transferred to platforms such as a trusted platform and the like is ensured.
Drawings
Fig. 1 is a schematic diagram of a terminal structure of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a plug-in compatibility method of a browser according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a plug-in compatibility method of a browser according to another embodiment of the present invention;
FIG. 4 is a flowchart illustrating a plug-in compatibility method for a browser according to another embodiment of the present invention;
fig. 5 is a schematic diagram of a module structure of a plug-in compatible device of the browser according to the present invention.
The implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention provides a solution, by identifying the plug-in nodes which are not adaptive to the browser and replacing the corresponding node information with the node information which is adaptive to the browser, the browser can normally display a display page, the compatibility of the browser and an active plug-in is realized, and the normal operation of an old system developed based on the active plug-in to a trusted platform and other platforms is ensured.
As shown in fig. 1, fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention.
The terminal of the embodiment of the invention can be a PC, a smart phone, a tablet computer and other terminal equipment.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. The communication bus 1002 is used to implement connection communication among these components. The user interface 1003 may include a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein a plug-in compatible program of an operating system, a network communication module, a user interface module, and a browser.
In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call a plug-in compatible program of the browser stored in the memory 1005 and perform the following operations:
when a browser detects a page triggering instruction, determining a corresponding page to be processed according to the page triggering instruction;
acquiring page resources of the page to be processed;
acquiring a DOM tree corresponding to the page resource;
determining nodes which are not adaptive to the browser in a DOM tree;
replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource;
and rendering the adjusted page resources through the browser.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
determining a node type corresponding to the DOM tree;
acquiring a preset identifier list corresponding to the node type;
and when the identifier of the node in the DOM tree exists in a preset identifier list corresponding to the node type of the node, taking the node as the node which is not adapted by the browser.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
determining a plurality of nodes in the DOM tree;
determining priorities of a plurality of nodes in the DOM tree;
and taking the node type of the node with the highest priority as the node type corresponding to the DOM tree.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
detecting whether node information of each node in the DOM tree is wrong;
if the node with the wrong node information exists, deleting the node with the wrong node information;
and determining the priorities of a plurality of nodes in the DOM tree after the node with the wrong node information is deleted.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
and when the identifier of the node in the DOM tree does not exist in the preset identifier list corresponding to the node type of the node, taking the node as the node which can be adapted by the browser.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
determining a node type corresponding to the DOM tree;
acquiring a node information conversion rule corresponding to the node type;
and acquiring the node information adaptable to the browser according to the node conversion rule and the node information of the node unsuitable for the browser.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
acquiring each attribute information in the node information of the node which is not adapted to the browser;
acquiring target attribute information corresponding to each attribute information according to the node conversion rule;
and generating node information which can be adapted to the browser according to the target attribute information.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
determining the plug-in type of the node which is not adapted to the browser;
acquiring a plurality of preset node information conversion rules corresponding to the plug-in type;
and determining a node information conversion rule corresponding to the node type in a plurality of preset node information conversion rules.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
and rendering the page resource through the browser when the DOM tree does not have a node which is not adaptive to the browser.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
displaying the page to be processed according to the display data obtained by rendering;
detecting whether the page to be processed is normally displayed or not;
and when the page to be processed is not normally displayed, returning to execute the step of acquiring the DOM tree corresponding to the page resource.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
when the browser is installed successfully, acquiring an operation platform where the browser is located;
and when the operating platform is a trusted platform, executing the step of determining the corresponding page to be processed according to the page triggering instruction when the browser detects the page triggering instruction.
Further, the processor 1001 may call a plug-in compatible program of the browser stored in the memory 1005, and also perform the following operations:
when detecting that an operating system is migrated to an operating platform where the browser is located, acquiring system information of the operating system;
judging whether the operating system is matched with an operating platform where the browser is located or not according to the system information;
and if not, executing the step of determining the corresponding page to be processed according to the page triggering instruction when the browser detects the page triggering instruction.
Referring to fig. 2, in an embodiment, a plug-in compatible method of a browser includes the following steps:
step S10, when a browser detects a page triggering instruction, determining a corresponding page to be processed according to the page triggering instruction;
step S20, acquiring page resources of the page to be processed;
in this embodiment, the capability of the page parser is expanded at the browser kernel level, so that the page parser provides support for active and other plug-ins, and compatibility with the active and other plug-ins is realized. The browser detects a page triggering instruction, and indicates that the browser needs to load, analyze and render resources of a corresponding page to be processed, so that the page to be processed is displayed in the browser. For example, a user may implement triggering of a page triggering instruction by clicking in a browser, so that the browser loads, parses, and renders resources of a corresponding to-be-processed page.
Optionally, the browser may locally obtain the page resource of the page to be processed through the internet or a browser terminal, and load the page resource into the memory, so that the browser kernel can analyze the page resource.
Optionally, because private platforms such as the trusted platform and the like do not usually have IE browsers and active and other plug-ins, when the browsers are installed successfully, the operating platform where the browsers are located may be automatically determined to obtain platform information of the operating platform. When the running platform is the trusted platform, it indicates that the browser may not be compatible with active and other plug-ins, so step S10 may be executed.
Optionally, when the old systems are migrated to the running platform where the browser is located, the old systems may not run on the platforms normally, so that system information of the operating system may be obtained, and whether the operating system is matched with the running platform where the browser is located may be determined according to the system information, that is, whether the operating system is an old system with respect to the running platform where the browser is located may be determined. If not, step S10 may be executed to implement the compatibility between the browser and the plug-in. If so, step S10 may not be performed.
Step S30, acquiring a DOM tree corresponding to the page resource;
in this embodiment, the browser kernel generates a corresponding DOM (Document Object Model) tree according to an HTML (HyperText Markup Language) Document of a page resource in the memory.
Optionally, the DOM tree is a node tree, the DOM tree comprising a plurality of element nodes, e.g., nodes of a plug-in.
Step S40, determining nodes which are not adapted to the browser in the DOM tree;
in the embodiment, the plug-in nodes in the DOM tree are identified, so that the nodes which are not adaptive to the local browser are determined. Wherein the node is not compatible with the browser, indicating that the plug-in for the node is not compatible with the browser. For example, the browser of the information creation platform is not a traditional IE browser and often cannot be compatible with an active plugin based on the IE browser, that is, a node corresponding to the active plugin is not adapted to the browser of the information creation platform.
Step S50, replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource;
in this embodiment, the DOM tree includes a plurality of nodes and node information of each node, where the node information includes information such as an attribute and a style of the node. The node information of the nodes which are not adapted to the browser is replaced by the node information which is adapted to the browser, so that the browser can normally identify the node information of the plug-in. It can be understood that the node information before replacement is consistent with the page picture finally presented by the node information after replacement, and only the description mode is different. For example, the FileName attribute in the node information of the active plugin is replaced with the src attribute.
Optionally, the browser prestores a conversion rule of the node information of each node that the browser is not adapted to, so as to implement conversion of the node information according to the corresponding conversion rule.
And step S60, rendering the adjusted page resource through the browser.
In this embodiment, after the page resource is adjusted, the adjusted page resource is rendered by the browser kernel, and the page is displayed based on the display data obtained by rendering.
Optionally, when there is no node in the DOM tree that is not adapted to the browser, it indicates that there is no need to convert node information, so that the page resource can be directly rendered by the browser kernel.
Optionally, after rendering the adjusted page resource through the browser, the page to be processed is displayed according to the display data obtained by rendering, so that the page to be processed is displayed. And if the page to be processed is not normally displayed, returning to the step of acquiring the DOM tree corresponding to the page resource to convert the node information again, so as to avoid the problem that the page cannot be normally displayed due to the conversion error of the node information. Optionally, whether the page to be processed is displayed normally is determined based on a feedback instruction of the user for the displayed page to be processed. For example, a feedback button may be displayed on the displayed page to be processed, so that when the user detects that the page to be processed is not normally displayed, the feedback button triggers a feedback instruction.
In the technical scheme disclosed in the embodiment, by identifying the plug-in nodes which are not adaptive to the browser and replacing the corresponding node information with the node information which is adaptive to the browser, the browser can normally display a display page, the compatibility of the browser and an active plug-in is realized, and the normal operation of an old system developed based on the active plug-in to platforms such as a trusted platform and the like is ensured.
In another embodiment, as shown in fig. 3, on the basis of the embodiment shown in fig. 2, the step S40 includes:
step S41, determining the node type corresponding to the DOM tree;
in this embodiment, since the plug-in may be described in different declaration manners, the node type of the DOM tree may be determined based on the declaration manner adopted by the plug-in node corresponding to the DOM tree, so as to detect whether the corresponding plug-in is adapted to the browser. For example, the windows media player plug-in may declare by using an object element or an embed element, when the windows media player plug-in declares by using the object element, the node type corresponding to the DOM tree is the object type, and when the windows media player plug-in declares by using the embed element, the node type corresponding to the DOM tree is the embed type.
Alternatively, for the windows media player plug-in, when the class id of the Object element is correct, the information of the Object element is used, when the class id of the Object element is incorrect, but the embed element of the embed is declared, the information of the embed element is used, when only the embed element of the embed is declared, the information of the embed element is used, when the class id of the Object element is correct, and the information of the Object element is used, when the embed element of the embed is declared, so that a plurality of nodes in the DOM tree can set different priorities. When determining the node type corresponding to the DOM tree, the priorities of the nodes in the DOM tree can be determined, and the node type of the node with the highest priority is used as the node type corresponding to the DOM tree, for example, the priority of the object node can be set to be higher than that of the embed node, so that when the class id of the object node is correct, the object type with the high priority is used as the node type corresponding to the DOM tree, and if only the embed element exists, the embed type with the high priority is used as the node type corresponding to the DOM tree.
Optionally, when determining the priorities of the nodes in the DOM tree, it may be detected whether the node information of each node in the DOM tree is wrong, if there is a node with wrong node information, the node with wrong node information is deleted, and the priorities of the nodes in the DOM tree are determined in the DOM tree after the node with wrong node information is deleted. For example, when the class of the object node is wrong, the object node can be deleted, and in the DOM tree after deletion of the object node, the embedded type with high priority is used as the node type corresponding to the DOM tree.
Step S42, acquiring a preset identifier list corresponding to the node type;
in this embodiment, the browser is preset with a preset identifier list corresponding to each node type. For example, a classid list corresponding to the object type and a mime type list corresponding to the embed type may be preset. It should be noted that the plugin of the node corresponding to the preset identifier list is a plugin that is not adapted to the browser.
And S43, when the identifier of the node in the DOM tree exists in a preset identifier list corresponding to the node type of the node, taking the node as the node which is not adapted to the browser.
In this embodiment, when the identifier of the node in the DOM tree exists in the preset identifier list corresponding to the node type of the node, it indicates that the plug-in of the node is not adapted to the browser, so that the node is taken as a node that is not adapted to the browser. For example, when the class id of the object node exists in the class id list corresponding to the preset object type, the object node is considered as a node which is not adapted by the browser.
Optionally, if the identifier of the node in the DOM tree does not exist in the preset identifier list corresponding to the node type of the node, the node is taken as a node adaptable to the browser, and the plug-in of the node is a plug-in compatible with the browser.
In the technical scheme disclosed in this embodiment, a node type corresponding to a DOM tree is determined, a preset identifier list corresponding to the node type is acquired, and when an identifier of a node in the DOM tree exists in the preset identifier list corresponding to the node type of the node, the node is used as a node which is not adapted to a browser, so that whether a plug-in node is adapted to the browser or not is detected.
In another embodiment, as shown in fig. 4, on the basis of the embodiment shown in any one of fig. 2 to fig. 3, before the step S50, the method further includes:
step S70, determining the node type corresponding to the DOM tree;
step S80, acquiring a node information conversion rule corresponding to the node type;
in this embodiment, before replacing the node information of the node that is not adapted to the browser with the node information that is adapted to the browser, the node information that is adapted to the browser needs to be generated. Specifically, the node types corresponding to the DOM tree may include an object type, an embed type, and the like, and different node types are provided with different node information conversion rules, for example, the object type corresponds to a node information conversion rule corresponding to a PARAM child node, and the embed type corresponds to a node information conversion rule corresponding to attribute.
Optionally, when a node information conversion rule corresponding to a node type is obtained, a plug-in type to which a node that is not adapted to the browser belongs may be determined first. For example, plug-in types may include active plug-ins, NPAPI plug-ins, and the like. Different plug-in types respectively correspond to a plurality of preset node information conversion rules, and because the declaration modes of the nodes of the same plug-in type can be different, the same plug-in type can correspond to a plurality of different preset node information conversion rules. And determining a node information conversion rule corresponding to the node type in the plurality of preset node information conversion rules. For example, a plurality of preset node information conversion rules corresponding to the active plugin are obtained, and when the node type corresponding to the active plugin is the object type, the node information conversion rule of the PARAM child node corresponding to the object type is determined.
And S90, acquiring node information adaptable to the browser according to the node conversion rule and the node information of the node unsuitable for the browser.
In this embodiment, when performing the conversion of the node information, each attribute information in the node information of the node that is not adapted to the browser may be obtained, and the target attribute information corresponding to each attribute information may be obtained according to the node conversion rule. For example, for the node information conversion rule of the PARAM child node, the FileName attribute in the node information may be converted into the src attribute, and for example, the ShowStatusBar attribute may be converted into the control attribute. And combining the plurality of target attribute information to generate the node information which can be adapted to the browser.
In the technical scheme disclosed in this embodiment, a node type corresponding to a DOM tree is determined, a node information conversion rule corresponding to the node type is acquired, and node information adaptable to a browser is acquired according to the node conversion rule and node information of a node not adapted to the browser, so that conversion of the node information is realized.
In another embodiment, based on the embodiment shown in any one of fig. 2 to 4, an example of a plug-in compatible method of a browser is as follows:
the capability of the page resolver is expanded at the level of a browser kernel, and support for active plug-ins is provided. When the resource is analyzed, the browser recognizes active plug-ins and replaces the elements with the elements that the browser can recognize. For example, after the resource loading is completed, the page parser may analyze the DOM node of the page; and after finding the object element, reading the class of the object element, dematching the class list of the parser, if the matching is successful, newly building an html5 video type node, and continuously reading the PARAM child node of the object node. For a PARAM child node with a FileName attribute, converting the PARAM child node into a src attribute of video; for a node with the property ShowStatusBar, it will be converted to the control property of video. And then continuing to read the embed child node of the original node, and if the embed child node is found to exist, discarding the node. And finally, replacing the original node by the newly-built node.
The embodiment provides a method for being compatible with an IE + active plugin on a trusted platform, and some systems developed for the IE and having the active plugin can be browsed normally under the trusted platform.
In addition, an embodiment of the present invention further provides a plug-in compatible device for a browser, where the plug-in compatible device for a browser includes: the system comprises a memory, a processor and a plug-in compatible program of the browser, wherein the plug-in compatible program of the browser is stored on the memory and can run on the processor, and when the plug-in compatible program of the browser is executed by the processor, the steps of the plug-in compatible method of the browser are realized.
In addition, an embodiment of the present invention further provides a computer storage medium, where a plug-in compatible program of a browser is stored on the computer storage medium, and when being executed by a processor, the plug-in compatible program of the browser implements the steps of the plug-in compatible method of the browser according to the above embodiments.
In addition, as shown in fig. 5, an embodiment of the present invention further provides a plug-in compatible device for a browser, where the plug-in compatible device for a browser includes:
the identification module 1 is used for determining a corresponding to-be-processed page according to a page trigger instruction when the browser detects the page trigger instruction, acquiring page resources of the to-be-processed page, acquiring a DOM (document object model) tree corresponding to the page resources, and determining a node which is not adapted to the browser in the DOM tree;
the replacing module 2 is used for replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource;
and the rendering module 3 is used for rendering the adjusted page resources through the browser.
Optionally, the identifying module 1 is further configured to determine a node type corresponding to the DOM tree, obtain a preset identifier list corresponding to the node type, and use the node as a node that is not adapted to the browser when the identifier of the node in the DOM tree exists in the preset identifier list corresponding to the node type of the node.
Optionally, the identifying module 1 is further configured to determine a plurality of nodes in the DOM tree, determine priorities of the plurality of nodes in the DOM tree, and use a node type of a node with a highest priority as the node type corresponding to the DOM tree.
Optionally, the plug-in compatible device of the browser further includes:
and the acquisition module is used for determining the node type corresponding to the DOM tree, acquiring the node information conversion rule corresponding to the node type, and acquiring the node information adaptable to the browser according to the node conversion rule and the node information of the node not adapted to the browser.
Optionally, the obtaining module is further configured to obtain each attribute information in the node information of the node that is not adapted to the browser, obtain target attribute information corresponding to each attribute information according to the node conversion rule, and generate node information that is adapted to the browser according to the target attribute information.
Optionally, the identifying module 1 is further configured to, when detecting that the operating system migrates to the operating platform where the browser is located, obtain system information of the operating system, determine whether the operating system is matched with the operating platform where the browser is located according to the system information, and if not, execute a step of determining a corresponding page to be processed according to the page triggering instruction when the browser detects the page triggering instruction.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. A plug-in compatibility method of a browser is characterized by comprising the following steps:
when a browser detects a page triggering instruction, determining a corresponding page to be processed according to the page triggering instruction;
acquiring page resources of the page to be processed;
acquiring a DOM tree corresponding to the page resource;
determining nodes which are not adapted to the browser in the DOM tree;
replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource;
and rendering the adjusted page resources through the browser.
2. The plug-in compatibility method for a browser according to claim 1, wherein said step of determining a node in a DOM tree that is not adapted to said browser comprises:
determining a node type corresponding to the DOM tree;
acquiring a preset identifier list corresponding to the node type;
and when the identifier of the node in the DOM tree exists in a preset identifier list corresponding to the node type of the node, taking the node as the node which is not adapted to the browser.
3. The plug-in compatibility method of a browser according to claim 2, wherein said step of determining the node type corresponding to the DOM tree comprises:
determining a plurality of nodes in the DOM tree;
determining the priority of a plurality of nodes in the DOM tree;
and taking the node type of the node with the highest priority as the node type corresponding to the DOM tree.
4. The plug-in compatible method for a browser according to claim 2, wherein after the step of obtaining a preset list of identifiers corresponding to the node type, the method further comprises:
and when the identifier of the node in the DOM tree does not exist in a preset identifier list corresponding to the node type of the node, taking the node as the node which can be adapted by the browser.
5. The plug-in compatibility method for a browser according to claim 1, wherein before the step of replacing the node information of the node to which the browser is not adapted with the node information to which the browser is adapted, the method further comprises:
determining a node type corresponding to the DOM tree;
acquiring a node information conversion rule corresponding to the node type;
and acquiring the node information adaptable to the browser according to the node conversion rule and the node information of the node unsuitable for the browser.
6. The plug-in compatible method for browser according to claim 5, wherein the step of acquiring node information adaptable to the browser based on the node conversion rule and node information of a node that is not adapted to the browser comprises:
acquiring each attribute information in the node information of the node which is not adapted to the browser;
acquiring target attribute information corresponding to each attribute information according to the node conversion rule;
and generating node information which can be adapted to the browser according to the target attribute information.
7. The plug-in compatible method for a browser according to claim 5, wherein the step of obtaining the node information conversion rule corresponding to the node type includes:
determining the plug-in type of the node which is not adapted to the browser;
acquiring a plurality of preset node information conversion rules corresponding to the plug-in type;
and determining a node information conversion rule corresponding to the node type in a plurality of preset node information conversion rules.
8. A plug-in compatible device for a browser, the plug-in compatible device for a browser comprising: memory, processor and a plug-in compatible program of a browser stored on said memory and executable on said processor, the plug-in compatible program of a browser implementing the steps of the plug-in compatible method of a browser according to any one of claims 1 to 7 when executed by said processor.
9. A computer storage medium, characterized in that the computer storage medium has stored thereon a plug-in compatible program of a browser, which when executed by a processor implements the steps of the plug-in compatible method of a browser according to any one of claims 1 to 7.
10. A plug-in compatible device for a browser, the plug-in compatible device for a browser comprising:
the identification module is used for determining a corresponding page to be processed according to a page trigger instruction when the browser detects the page trigger instruction, acquiring page resources of the page to be processed, acquiring a DOM tree corresponding to the page resources, and determining nodes which are not adapted to the browser in the DOM tree;
the replacing module is used for replacing the node information of the node which is not adapted to the browser with the node information which is adapted to the browser so as to adjust the page resource;
and the rendering module is used for rendering the adjusted page resources through the browser.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111111168.6A CN115904524A (en) | 2021-09-22 | 2021-09-22 | Plug-in compatible method, device and equipment for browser and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111111168.6A CN115904524A (en) | 2021-09-22 | 2021-09-22 | Plug-in compatible method, device and equipment for browser and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115904524A true CN115904524A (en) | 2023-04-04 |
Family
ID=86478364
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111111168.6A Pending CN115904524A (en) | 2021-09-22 | 2021-09-22 | Plug-in compatible method, device and equipment for browser and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115904524A (en) |
-
2021
- 2021-09-22 CN CN202111111168.6A patent/CN115904524A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110990731B (en) | Rendering method, device and equipment of static webpage and computer storage medium | |
KR101999409B1 (en) | Formatting data by example | |
CN108415804B (en) | Method for acquiring information, terminal device and computer readable storage medium | |
US9529820B2 (en) | Automated content tracking and conversion | |
JP2011070640A (en) | Method and system for converting desktop application to web application | |
WO2016177341A1 (en) | Interface calling method and device, and terminal | |
CN110941779B (en) | Page loading method and device, storage medium and electronic equipment | |
CN108197024B (en) | Embedded browser debugging method, debugging terminal and computer readable storage medium | |
CN108415998B (en) | Application dependency relationship updating method, terminal, device and storage medium | |
CN111124544A (en) | Interface display method and device, electronic equipment and storage medium | |
CN110990732A (en) | Loading method, device and equipment based on webpage and storage medium | |
CN111522849A (en) | Database dynamic access method, server and storage medium | |
US9571557B2 (en) | Script caching method and information processing device utilizing the same | |
CN113535587B (en) | Target application detection method and device and computer equipment | |
CN112800194B (en) | Interface change identification method, device, equipment and storage medium | |
JP5039946B2 (en) | Technology for relaying communication between client devices and server devices | |
CN114443905A (en) | Interface document updating method and device, electronic equipment and readable storage medium | |
JP5535184B2 (en) | Browser execution script conversion system and browser execution script conversion program | |
CN109597952B (en) | Webpage information processing method, system, electronic equipment and storage medium | |
EP3502925B1 (en) | Computer system and method for extracting dynamic content from websites | |
CN111158777A (en) | Component calling method and device and computer readable storage medium | |
KR20170105325A (en) | Method for analyzing source code, system and apparatus for executing the method | |
CN115904524A (en) | Plug-in compatible method, device and equipment for browser and storage medium | |
CN106598663B (en) | Web application updating method and web server | |
CN112507346A (en) | Vulnerability scanning system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |