[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN116702147A - Webpage loading method, device and equipment in light application and computer storage medium - Google Patents

Webpage loading method, device and equipment in light application and computer storage medium Download PDF

Info

Publication number
CN116702147A
CN116702147A CN202210186267.9A CN202210186267A CN116702147A CN 116702147 A CN116702147 A CN 116702147A CN 202210186267 A CN202210186267 A CN 202210186267A CN 116702147 A CN116702147 A CN 116702147A
Authority
CN
China
Prior art keywords
page
target
target page
script
page frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210186267.9A
Other languages
Chinese (zh)
Inventor
张德明
郭沛然
蔡经纬
赵景晨
黄昱珲
林楷帆
梁兆鹏
林政�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210186267.9A priority Critical patent/CN116702147A/en
Publication of CN116702147A publication Critical patent/CN116702147A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/44Program or device authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a webpage loading method, device and equipment in a light application and a computer storage medium, belongs to the technical field of computers, and is used for loading embedded webpages in the light application in a browser environment. The method comprises the following steps: injecting a first simulation script into the target page frame based on the creation of the target page frame; the target page framework corresponds to a target page of a target light application running in the browser; running a first simulation script, when determining that the target page frame belongs to the network view type, creating an authentication function label for the target page, and injecting the authentication function label into a source code corresponding to the target page frame; running an authentication script appointed by an authentication function label, and authenticating the loading authority of the target page frame to obtain a corresponding authentication result; and if the authentication result indicates that the loading of the target page framework is allowed, executing the source code and displaying the target page in the target light application.

Description

Webpage loading method, device and equipment in light application and computer storage medium
Technical Field
The application relates to the technical field of computers, in particular to the technical field of object retrieval, and provides a webpage loading method, device and equipment in a light application and a computer storage medium.
Background
With the development of the mobile internet, developers use clients or browsers as tools in the internet to provide services for users. Taking an instant messaging application client as an example, a developer can provide differentiated services in a light application mode by taking the instant messaging application client as a host, and likewise, a browser can also serve as a host to run the light application to provide services for users.
Taking a light application as an applet for example, in order to reduce the burden of a developer, some clients provide an applet web view (web-view) component, an applet web-view component can be used at the development end, a third-party webpage is embedded in a page frame (frame) of the applet, and the embedded webpage content can be loaded at the use end based on the applet web-view component, so that for a project of a mobile website already developed, if an applet version is required to be developed, the content of the mobile website is only required to be placed on the embedded applet page frame through the component.
However, although web page embedding has been enabled in some clients, the applet in the browser environment still does not have the function of loading the embedded web page, and the difference between the browser and the client's running environment makes it difficult for the browser applet to be compatible with the applet web-view component of the client.
Thus, how to implement loading of embedded web pages in light applications such as applets in a browser environment is a problem that is currently in need of solution.
Disclosure of Invention
The embodiment of the application provides a webpage loading method, device and equipment in a light application and a computer storage medium, which are used for loading embedded webpages in the light application in a browser environment.
In one aspect, a method for loading a web page in a light application is provided, the method comprising:
injecting a first simulation script into a target page frame based on creation of the target page frame; the target page framework corresponds to a target page of a target light application running in the browser, and the first simulation script is used for providing a required running environment for a network view type page in the target light application;
running the first simulation script, when the target page frame is determined to belong to a network view type, creating an authentication function label for the target page, and injecting the authentication function label into a source code corresponding to the target page frame;
running an authentication script appointed by the authentication function label, and authenticating the loading authority of the target page frame to obtain a corresponding authentication result;
And if the authentication result indicates that the target page frame is allowed to be loaded, executing the source code, and displaying the target page in the target light application.
In one aspect, there is provided a web page loading apparatus within a lightweight application, the apparatus comprising:
the script injection unit is used for injecting a first simulation script into the target page frame based on the creation of the target page frame; the target page framework corresponds to a target page of a target light application running in the browser, and the first simulation script is used for providing a required running environment for a network view type page in the target light application;
the authentication tag injection unit is used for running the first simulation script, creating an authentication function tag for the target page when the target page frame is determined to belong to a network view type, and injecting the authentication function tag into a source code corresponding to the target page frame;
the authentication unit is used for running an authentication script appointed by the authentication function label, authenticating the loading authority of the target page frame and obtaining a corresponding authentication result;
and the execution unit is used for executing the source code and displaying the target page in the target light application if the authentication result indicates that the target page frame is allowed to be loaded.
Optionally, the browser includes an operation environment simulation plug-in, and the main configuration file of the operation environment simulation plug-in indicates a page frame condition and an injection position of the first simulation script to be injected, and the script injection unit is specifically configured to:
and triggering the operation environment simulation plug-in based on the creation of the target page frame, and injecting the first simulation script at the corresponding position of the target page frame according to the injection position indicated by the main configuration file when the target page frame meets the page frame condition.
Optionally, the page frame condition includes a main page frame and an inline page frame of the target light application, and a main page frame and an inline page frame of the browser, and the injection position is a start position of a source code of the page frame; the script injection unit is specifically configured to:
based on the creation of the target page frame, the running environment simulation plugin determines that the target page frame meets the page frame condition; the method comprises the steps of,
and injecting the first simulation script at the starting position of the source code of the target page frame so that the first simulation script can run before the source code.
Optionally, the authentication unit is specifically configured to:
acquiring a page resource address of the target page and login information of the target light application;
and running the authentication script, and authenticating the loading authority of the target page frame based on the page resource address and the login information.
Optionally, the apparatus further includes a secure channel establishment unit configured to:
calling an event state interface of a window object, and establishing a first communication channel between the first simulation script and the target page frame;
calling a message channel interface of the browser, and creating a first message channel between the first simulation script and the running environment simulation plug-in;
calling the message channel interface, and creating a second message channel between a second simulation script injected into a light application page framework included by the target light application and the running environment simulation plug-in;
and calling the event state interface, and establishing a second communication channel between the second simulation script and the light application page framework.
Optionally, the authentication unit is specifically configured to:
invoking the second simulation script, and receiving login information in the light application page frame sent through the second communication channel;
Calling the operation environment simulation plug-in, receiving the login information sent by the second simulation script through the second message channel, and sending the login information to the first simulation script through the first message channel;
invoking the first simulation script, and sending the login information to the authentication script through the first communication channel;
and calling the authentication script to acquire the page resource address from the source code.
Optionally, the apparatus further comprises an information modification unit for:
creating an information modification function tag for the target page through the first simulation script, and injecting the information modification function tag into the source code;
running an information modification script designated by the information modification function label, adding an object agent identifier for the obtained login information, and sending the login information with the object agent identifier added to the source code, so that the source code is executed based on the login information with the object agent identifier added; the method comprises the steps of,
determining a target window size of the target page based on the obtained actual screen size of the current device, and transmitting the target window size to the source code, so that the source code is executed based on the target window size.
In one aspect, a computer device is provided comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of any of the methods described above when the computer program is executed.
In one aspect, there is provided a computer storage medium having stored thereon computer program instructions which, when executed by a processor, perform the steps of any of the methods described above.
In one aspect, a computer program product or computer program is provided, the computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the steps of any of the methods described above.
In the embodiment of the application, when a target page in a target lightweight application is opened in a browser environment, namely after a target page frame is created for the target page, a first simulation script is injected into the target page frame, the first simulation script is used for providing a required operation environment for a page of a network view type, so that the first simulation script is operated, when the target page frame is determined to belong to the network view type, an authentication function tag is created for the target page, the authentication function tag is injected into a source code corresponding to the target page frame, an authentication script appointed by the authentication function tag is operated, the loading authority of the target page frame is authenticated, if the authentication result indicates that the target page frame is allowed to be loaded, the source code is executed, so that the target page is displayed in the target lightweight application, in this way, the authentication operation can be completed before the source code corresponding to the target page is executed, the source code is continuously loaded when the authority loading is ensured, and the safe loading of the target page is realized.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described, and it is apparent that the drawings in the following description are only embodiments of the present application, and other drawings may be obtained according to the provided drawings without inventive effort for those skilled in the art.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
FIG. 2 is a system architecture diagram provided in an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for loading a web page in a light application according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a hierarchical relationship between pages in a applet according to an embodiment of the present application;
fig. 5 is a schematic flow chart of the injection authentication function tag according to the embodiment of the present application;
fig. 6 is a schematic flow chart of the injection authentication function tag according to the embodiment of the present application;
FIGS. 7 a-7 c are schematic diagrams illustrating interfaces according to embodiments of the present application;
fig. 8 is a schematic flow chart of establishing a secure communication link according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a secure communication link provided by an embodiment of the present application;
FIG. 10 is a schematic diagram of a page loading process of a Linux applet hardware framework according to an embodiment of the present application;
FIG. 11 is a schematic diagram of a configuration of a device for loading a web page in a lightweight application according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application. Embodiments of the application and features of the embodiments may be combined with one another arbitrarily without conflict. Also, while a logical order is depicted in the flowchart, in some cases, the steps depicted or described may be performed in a different order than presented herein.
In order to facilitate understanding of the technical solution provided by the embodiments of the present application, some key terms used in the embodiments of the present application are explained here:
Light application: the light application is a program which is not required to be downloaded, namely, is used as a search and use program, takes a client as a host, runs in a host running environment, and can be used for obtaining services provided by a light application provider by directly opening the light application in the client, wherein the light application can be in the forms of an applet, a public number and the like. The characteristics of no need of downloading, namely search and use, enable the client to be installed without occupying the storage space of the terminal equipment, save the storage space more and operate quickly.
Page frame: opening a page in the client creates a corresponding page frame for the page. The page frames may include page frames corresponding to pages of the host program, page frames corresponding to pages of the light application, and page frames may include page frames of the main page or inline page frames (iframes) in the pages according to the hierarchical division of the pages.
Network view (web-view): is web-view refers to a web page embedded in a lightweight application, which may be, for example, a web page of a third party. In some cases, a developer has already developed a webpage of the developer and wants to develop a light application version, then the existing webpage can be directly embedded into the light application in a web-view mode, so that the development of the webpage of the light application version is avoided again, and the development efficiency is improved; in addition, if the content of other webpages is to be embedded in one page, the web-view mode can also be adopted to directly embed the webpage content in the page, so that the embedded content can be simultaneously displayed when the page is displayed.
And (3) a browser: in the embodiment of the application, the light application is hosted as a browser, and in general, some browsers can support function expansion, so that the method flow provided by the embodiment of the application can be realized by utilizing an expansion interface of the browser.
Taking a browser with a Chromium browser kernel as an example, the Chromium browser kernel is an open-source browser kernel, and a Chromium Extension (Extension) framework is a framework in the browser, which allows a developer to expand the functions of the browser by adopting JavaScript (JS, a lightweight programming language), and a Linux runtime framework, namely a Linux applet hardware framework (Linux WMPF), realized in the background of the Chromium browser kernel cannot support the functions of a web-view component in the native environment of the Linux applet hardware framework (Linux WMPF), but the embodiment of the application expands the functions of the browser based on Chromium Extension to simulate the environment of a client, so that the normal loading of an embedded webpage in light application can still be supported in the environment of the browser.
Client side: the mobile terminal is called as a mobile terminal, and can refer to a client in a client platform such as iOS or Android (Android), and correspondingly, a client applet refers to an applet framework running by taking the client as a host.
Window object: window objects are objects that the browser gives to javascript to describe a frame Window, which must be implemented using the interface of the object if javascript is desired to operate on a good page.
The following briefly describes the design concept of the embodiment of the present application.
At present, the light application provides convenience service for users by the characteristic that the light application does not need to be downloaded or used immediately after searching. For example, when the light application is an applet, some clients provide an applet web-view component to embed a third party webpage in the applet's page frame in order to reduce the developer's burden.
However, the browser is very different from the client's operating environment, making it difficult for the browser applet to be compatible with the applet web-view component of the client. Taking Linux WMPF as an example, because of the particularity of the Linux WMPF operating environment, the access party is very diverse and can access any platform that can operate the browser kernel, and the platform-side compatible mode is not universal, and it does not support a web-view component, and only an iframe is embedded in a page, and it cannot be normally loaded.
The inability to implement the functionality of the web-view component on the Linux WMPF is considered because there is no functional software development kit (Software Development Kit, SDK) and functional interface for the applet web-view component in this environment. For example, the applet web-view component in the instant messaging client includes the JS interface of the instant messaging client to implement a channel for embedding the web frame to communicate with the applet frame, i.e., JSBridge, so in order to implement the function of the applet web-view component in the browser, the following conditions are required to be satisfied in the browser environment:
(1) The need to support injection of script scripts in any frame;
(2) It is desirable to create a link that the embedded web page framework can securely communicate with the applet framework, but is not perceivable by the embedded web page framework.
(3) It is desirable to be able to authenticate, simulate a web-view environment, etc. before embedding the web page framework to execute the source code.
In view of this, an embodiment of the present application provides a method for loading a web page based on a lightweight application, in which, when a target page in a target lightweight application is opened in a browser environment, i.e. after a target page frame is created for the target page, a first simulation script is injected into the target page frame, the first simulation script is used for providing a required running environment for a web view type page, so as to run the first simulation script, when it is determined that the target page frame belongs to the web view type, an authentication function tag is created for the target page, and the authentication function tag is injected into a source code corresponding to the target page frame, an authentication script specified by the authentication function tag is run, authenticating the loading authority of the target page frame, if the authentication result indicates that the target page frame is allowed to be loaded, then executing the source code, so that the target page is displayed in the target lightweight application, in this way, before executing the source code corresponding to the target page, the authentication operation can be completed, and when the authority is loaded, the source code is loaded, the safe loading of the target page is realized.
Meanwhile, a modification function tag can be inserted before the source code to modify the current running environment so as to simulate the same or similar web-view environment as the client.
In addition, in order to establish a secure channel between the embedded page frame and the light application self page frame, the embodiment of the application creates a communication channel between the injected script and the page frame by calling an event state (event) interface of a window object, and creates a message channel between the page frame and a plug-in background by utilizing a message channel (message channel) interface of a browser so as to realize communication between the light application page frame and the embedded page frame.
The following description is made for some simple descriptions of application scenarios applicable to the technical solution of the embodiment of the present application, and it should be noted that the application scenarios described below are only used for illustrating the embodiment of the present application, but not limiting. In the specific implementation process, the technical scheme provided by the embodiment of the application can be flexibly applied according to actual needs.
The scheme provided by the embodiment of the application can be suitable for the light application scene taking the browser as a host. As shown in fig. 1, an application scenario is schematically provided in an embodiment of the present application, where the scenario may include a terminal device 101, a light application server 102, an embedded web server 103, and an authentication server 104.
The terminal device 101 may be, for example, a mobile phone, a tablet computer (PAD), a notebook computer, a desktop computer, a smart television, a smart car device, a smart wearable device, etc. The terminal device 101 may be installed with a browser in which a user may open a light application.
The light application server 102 is a background server corresponding to the light application opened in the browser, and is used for providing services related to the self page of the light application. For example, user account management, login and other related functions can be provided to enable user account login and use in light applications.
The embedded web page server 103 is a background server corresponding to the embedded web page in the light application, and is used for providing background service for the embedded web page. For example, data required for display of the embedded web page is provided.
The authentication server 104 is a server corresponding to the plug-in provided by the embodiment of the present application, and is configured to implement an authentication function when loading an embedded web page, and may also provide other relevant background services for the plug-in.
The servers may be, for example, independent physical servers, a server cluster or a distributed system formed by a plurality of physical servers, or cloud servers providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, i.e., content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms, but are not limited thereto.
The terminal device 101 may include one or more processors, memory, and interface with interactive I/O, etc. The memory may also store program instructions of the method for loading a web page in a light application provided by the embodiment of the present application, where the program instructions, when executed by the processor, can be used to implement steps of the method for loading a web page in a light application provided by the embodiment of the present application, so as to implement a loading process of an embedded web page in a light application.
The devices described above may be in direct or indirect communication connection via one or more networks 105. The network 105 may be a wired network, or may be a Wireless network, for example, a mobile cellular network, or may be a Wireless-Fidelity (WIFI) network, or may be other possible networks, which the embodiments of the present application are not limited to.
Referring to fig. 2, a system architecture diagram provided in an embodiment of the present application is shown. Among these, in this architecture, a browser 201, a running environment simulation module, a light application 203, and an embedded web page 204 are included.
Wherein the light application 203 hosts the browser 201, and when it is running, the embedded web page 204 may be run in the light application 203. In order to achieve normal loading of the embedded web page 204, the simulation of the necessary running environment needs to be achieved through a running environment simulation module.
The runtime simulation module may include a runtime simulation plug-in 2021, where the runtime simulation plug-in 2021 may be integrated into the browser 201, and when the light application 203 in the browser 201 runs, the runtime simulation plug-in 2021 may also run with it, where the runtime simulation plug-in 2021 includes a master configuration file, manifest. Json, where the page framework to be injected and the location of the injected script file are configured. The runtime environment simulation module may also include a simulation script (content script) 2022, and the simulation script 2022 may include a second simulation script injected into the page frame of the light application 203 and a first simulation script injected into the embedded web page 204.
When the light application 203 runs, if a new page is opened, that is, a new page frame is created, the running environment simulation plug-in 2021 is triggered to inject a simulation script for the page frame, where the simulation script may be an initial position of source code corresponding to the page frame, so that the simulation script can run before the source code runs, and the running environment of the page is prepared in advance, so that the embedded web page can be loaded normally.
In addition, generally, when the embedded web page runs, authentication needs to be performed on the embedded web page to ensure the safety of program running, and the authentication can comprise verification of the safety of the embedded web page and verification of the authority of loading the embedded web page by a user. After the simulation script is injected into the page frame, because the simulation script and the page frame are mutually independent, in order to realize the authentication process, the simulation script can inject a function tag into the source code of the page frame, namely, inject the function tag into the source code in the form of the script tag, so that the function tag can be executed to assist in realizing the authentication process. Specifically, the running environment simulation module may further include an authentication service 2023, where the authentication service 2023 may be deployed in an authentication server, for example, so that the script tag may initiate an authentication request to the authentication service 2023, and determine whether to execute the source code based on the authentication result returned by the authentication service 2023 to determine whether to load the embedded web page.
Of course, the method provided by the embodiment of the present application is not limited to the application scenario shown in fig. 1 or the architecture of fig. 2, but may be used in other possible application scenarios or architectures, and the embodiment of the present application is not limited. The functions that can be implemented by the devices of the application scenario shown in fig. 1 or the modules shown in fig. 2 will be described together in the following method embodiments, which are not described herein again.
The method flow provided in the embodiments of the present application may be performed by the terminal device 101 in fig. 1, or may be performed by each server and the terminal device 101 together, and is mainly described herein by taking the terminal device 101 as an example.
Referring to fig. 3, a flow chart of a method for loading a web page in a light application according to an embodiment of the present application is shown, and in the following method embodiment, a function of implementing a web-view component on a Linux WMPF is mainly described as an example, and of course, under other browser frameworks, a corresponding expansion interface may also be adaptively adopted to implement the same function.
Step 301: injecting a first simulation script into the target page frame based on the creation of the target page frame; the target page framework corresponds to a target page of a target light application running in the browser, and the first simulation script is used for providing a required running environment for a network view type page in the target light application.
In the embodiment of the application, the target page can comprise a page included by the target light application, and also can comprise a webpage embedded into the target light application. When a web-view is opened in a light application, a new page frame is created at the browser level, and then whether a new page is opened or not can be judged by judging whether a page frame is created or not, and when the new page is opened, a simulation script needs to be injected into the page frame of the new page. Wherein the simulation script is used to provide the required running environment for the web view type page in the target light application.
It should be noted that, in the embodiment of the present application, the first simulation script and the second simulation script are used to distinguish the simulation scripts corresponding to the embedded web page and the light application self page, but do not represent the difference between the simulation scripts, that is, the first simulation script and the second simulation script may be the same simulation script, or may have a certain difference.
In the embodiment of the application, the operation environment simulation plug-in can be integrated in advance in the browser, and the corresponding main configuration file is configured, so that whether the simulation script is injected or not can be judged according to the main configuration file later, namely, the page frame condition and the injection position of the first simulation script to be injected are indicated in the main configuration file, and further, when the operation environment simulation plug-in is triggered based on the creation of the target page frame, and the target page frame is determined to accord with the page frame condition, the first simulation script is injected at the corresponding position of the target page frame according to the injection position indicated by the main configuration file.
In general, page frame conditions include a main page frame and an inline page frame of a target light application, and a main page frame and an inline page frame of a browser, that is, page frame conditions may be injection of a simulation script at any page. Furthermore, in order to enable the injected simulation script to be executed first, i.e. to prepare the environment required for the page loading in advance before the source code is run, the simulation script may be injected at the start position of the source code, i.e. the start position of the source code of the respective page frame. After the target page frame of the target page is created, the running environment simulation plug-in directly determines that the target page frame meets the page frame conditions, and therefore a first simulation script is injected into the starting position of the source code of the target page frame, and the first simulation script can run before the source code.
Referring to the following example, as one possible example of a master profile, the master profile below is content_scripts, which describes scripts to be injected into a page, in which a simulation script content. Js is indicated to be injected into all pages, so that, based on the profile, content. Js can be injected into all frames when the runtime environment simulates plug-ins running.
Step 302: and running a first simulation script, when the target page frame is determined to belong to the network view type, creating an authentication function label for the target page, and injecting the authentication function label into a source code corresponding to the target page frame.
In the embodiment of the application, the current environment needs to be distinguished to judge whether the environment required by the embedded webpage needs to be simulated and loaded or not. In general, in browser pages, pages are divided according to levels, and different pages correspond to different levels of identification.
In one possible implementation, taking a light application as an applet, a hierarchical relationship between pages within the applet is illustrated in fig. 4. The fixed home page is called as a active page, the corresponding level identification is 0, the iframe in the home page is called as a page, the corresponding level identification is 1, the iframe in the page is the applet web-view, the corresponding level identification is 2, and therefore the page type of the current page can be judged by acquiring the level identification. Of course, this is merely an example, and in practical application, the hierarchy identifier may also be identified by other expression modes.
Specifically, the first simulation script may include a page type obtaining method, and when the first simulation script runs, the page type obtaining method included in the first simulation script may be called to obtain the page type, and only when the current environment is judged to be a web-view environment, a subsequent authentication process is required. Referring to fig. 5, a schematic flow chart of the process of injecting the authentication function tag is shown.
Step 3021: calling a page type acquisition method to acquire a target level identifier of a target page in a browser; wherein the hierarchy identifier is used to characterize the hierarchy of the corresponding page in the browser page.
Specifically, by the page type obtaining method, an object attribute obtaining interface of the browser can be called to obtain a hierarchical identifier, for example, "location.identifier, i.e. length", which is an attribute in the window global object location, and by means of the attribute, whether the current page environment is a web-view environment, i.e. whether the current page is an embedded web page can be determined.
Of course, under other browser frameworks, a corresponding hierarchical identifier acquisition interface may be invoked to acquire the hierarchical identifier.
Step 3022: and calling a page type acquisition method, and determining the target page type of the target page frame based on the target level identification.
Specifically, after the target level identifier of the target page is obtained, the corresponding page type may be determined based on the target level identifier, for example, when the target level identifier is 2, it is indicated that the target page type is a web-view type, so as to output indication information indicating that the target page is a web-view type.
Referring to the following example, an example of the page type is output for the page type acquisition method export const getCurrWebviewType.
export const getCurrWebviewType=()=>{
constpagedepth=location.AncessorOrigins.length// get hierarchy identifier
if (pagedepth= =0) return webview type, active// if the hierarchy identifier is 0, the output page type is active, that is, the current page is indicated as a fixed top page;
if (pagedepth= =1) return webview type if the hierarchy identifier is 1, the output page type is page, that is, the current page is the iframe in the fixed top page;
if (pagedepth= =2) return webview type, webview component// if the hierarchy identifier is 2, the output page type is webview component, that is, the current page is indicated as iframe in the page;
}
step 3023: and judging whether the target page type belongs to the network view type.
Step 3024: when the determination result in step 3023 is yes, that is, the target page type is the network view type, an authentication function tag is created for the target page, and the authentication function tag is injected into the source code corresponding to the target page frame.
Specifically, based on the page type output in the above process, it can be determined whether the page type of the current target page is web-view, if yes, authentication needs to be performed on the page to determine whether to load the target page, so that an authentication function tag needs to be created for the target page, and the authentication function tag is injected into a source code corresponding to the target page frame.
Otherwise, if the determination result in step 3023 is no, that is, when it is determined that the current target page type is native or page, the browser is capable of supporting loading of the pages, so that no processing is required, and the flow ends.
Step 303: and running an authentication script appointed by the authentication function label, and authenticating the loading authority of the target page frame to obtain a corresponding authentication result.
In the embodiment of the application, considering the security requirement of web-view loading, authentication operation is needed, but although the simulation script is injected in the way of injection, in the browser expansion function, in order to protect the source code from being interfered, the injected script and the source code are isolated from each other, namely, the injected content script is isolated from the developer code in the web-view and cannot be perceived directly by each other, so that in order to realize authentication, the authentication process is needed to be carried out before the developer code is executed, and the page content is changed based on the authentication result.
Specifically, the effect of entering the source code can be achieved by injecting an authentication function tag into the window object of the target page frame through the injected first simulation script, namely content scirpt.
Referring to fig. 6, a schematic flow chart of the process of injecting the authentication function tag is shown.
Step 3031: creating a new script label, wherein the new script label is the authentication function label.
Step 3032: and designating the file position corresponding to the created script tag.
Step 3033: the created script tag is inserted into the source code of the target page frame.
In the embodiment of the application, in order to enable the content in the tag to be executed before the source code, the script tag can be inserted before the source code.
Referring to the following example, as one possible example of injecting an authentication function tag, creating a script tag in a browser and inserting the script tag into a page may be implemented by the following example, so that content in the tag may be executed by the browser.
const injectScript=(file:string)=>{
const contentScript = document. Create element ('script')/(call document. Create element method to create new script tag;
ContentiScript. Src=chrome. Run. GetURL (file)/specifying the file location to which the created script tag corresponds by invoking the getURL interface;
documetElement, appendfield (content script)/call appendfield method inserts created script tag into js file in frame;
}
In the embodiment of the application, the authentication process can verify the loading authority of the target page through the page resource address (Uniform Resource Locator, URL) of the target page and the login information of the current target light application.
Specifically, an authentication request can be initiated to a background authentication server through an authentication script, the authentication request can carry the page resource address and login information, an authentication result returned by the authentication server is received, and whether a target page is loaded or not is judged according to the returned authentication result.
In one possible implementation manner, a check function encapsulated in the authentication script may be called to initiate an ajax request to the background authentication server, and perform subsequent processing according to the returned authentication result, i.e. determine whether to prohibit the frame from continuing loading
See the following examples, which are one example of a check function checklimits.
const permissionRes =checkpermission (window. Location. Url)// information-carrying page resource, etc. requests;
if(!permissionRes.accept){
window. Location. Href= 'abs out: blank'// if loading is indicated to be prohibited, modify URL;
}
step 304: and if the authentication result indicates that the loading of the target page framework is allowed, executing target source codes and displaying the target page in the target light application.
Referring to fig. 7a, a schematic view of a target page is shown. After the user selects the embedded webpage 1, the embedded webpage 1 is authenticated through the above process, and if the authentication result indicates that the embedded webpage has no security risk, and the current login user allows loading the embedded webpage, that is, when the permission to load the embedded webpage is determined, the user can switch to the embedded webpage 1 for displaying.
Referring to fig. 7b, another display diagram of a target page is shown. The embedded web page is a part of a certain page in the light application, when the user opens the page of the light application, the embedded web page needs to be loaded, so that the above process still needs to be executed, the embedded web page is authenticated, if the authentication result indicates that the embedded web page is allowed to be loaded, as shown in fig. 7b, the embedded web page can be loaded and displayed in the light application page, so that the embedded web page is displayed in a nested display mode.
In the embodiment of the application, if the authentication result indicates that loading of the target page frame is forbidden, the authentication script is called to modify the hypertext reference attribute of the page orientation object into other contents different from the page resource address of the target page. That is, for the case that loading is impossible, the URL of the current page is directly changed to prevent continued loading.
Referring to fig. 7c, if the page is determined to be forbidden to be loaded after authentication, the URL may be modified to be a blank page, so that after the page is switched, the page may be skipped to be displayed.
In the embodiment of the application, when authentication is performed, the page resource address of the target page and login information in the current light application are required to be obtained, and under other conditions, secure communication between the target page frame and the light application internal page frame may also be required to be realized, so that a communication link for realizing the secure communication between the target page frame and the light application internal page frame, namely, communication from the frame source code where the web-view is located to the frame where the applet frame is located, is required to be created.
Referring to fig. 8, a flow chart for establishing a secure communication link is shown.
Step 801: and calling an event state interface of the window object, and establishing a first communication channel between the first simulation script and the target page frame.
In the embodiment of the application, because of the characteristic of the browser expansion function, in order to protect the page source code, the first simulation script content script injected by the browser expansion function and the frame source code of the page frame are mutually isolated, but the window object of the browser is shared with each other, and the window object is read-only, so that the communication between the source code and the content script can be realized through an event interface on the window object. The event refers to an event, and is a publish-subscribe mode provided in a browser, so that a subscription mode can be set to trigger the transfer of a message.
Referring to fig. 9, a schematic diagram of a secure communication link is shown. The source code embedded in the webpage and the corresponding first simulation script are communicated through a window event.
Step 802: and calling a message channel interface of the browser, and creating a first message channel between the first simulation script and the running environment simulation plug-in.
In the embodiment of the application, the browser generally comprises a message channel (message channel) interface, so that the communication between the first simulation script and the running environment simulation plug-in can be realized through the message channel interface. The Message channel interface allows, among other things, to create a new Message channel and send data via its two Message Port (Port) attributes.
Taking a browser using Linux WMPF as an example, chromium Extension included in the browser includes a message channel interface, content script injected into a page frame may be communicated with a plug-in background (background) of an operating environment simulation plug-in through the message channel interface.
Step 803: and calling a message channel interface, and creating a second message channel between a second simulation script of a light application page framework included in the target light application and the running environment simulation plug-in.
Step 804: and calling an event state interface, and establishing a second communication channel between the second simulation script and the light application page framework.
The same as the embedded web page, the page framework in the light application can also realize communication with the injected second simulation script through the event state interface of the window object, and the second simulation script can also realize communication with the plug-in background through a message channel.
It should be noted that, the steps are not substantially sequential, so in practical application, the steps may be performed sequentially or may be performed simultaneously in parallel, which is not limited by the embodiment of the present application.
Taking the communication link shown in fig. 9 as an example, when the page frame of the embedded web page needs to communicate with the page frame of the light application, the communication between the source code of the page frame of the embedded web page and the content script of the embedded web page can be realized through the event on the window object, and then the content script of the embedded web page can be communicated with the plug-in background through the message channel, and then the plug-in background is given to the page frame of the light application again through the message channel, and in the page frame of the light application, the content script corresponding to the light application page can also give the message content to the source code of the page frame of the light application through the event mechanism on the window object. Of course, the reverse communication is returned one by one according to the above procedure.
Because the event of the window object cannot be identified and intercepted under the condition that the event name is not known, the safety of the window event can be ensured, and meanwhile, the message channel is only provided for the interior of extension for use, so that the interaction between two frames is realized on the premise of ensuring the safety of the whole link again through the plug-in background and the transfer of the content of the window object.
In the embodiment of the application, taking an authentication process as an example, after the authentication function tag is inserted into the source code of the target page frame, because the authentication process needs to acquire the page resource address, login information and the like, the second simulation script can receive the login information in the light application page frame sent through the second communication channel and send the login information to the operation environment simulation plug-in through the second message channel, and then the operation environment simulation plug-in can send the login information to the first simulation script through the first message channel, so that the authentication script acquires the login information through the first communication channel. In addition, the authentication script can also obtain the page resource address from the source code.
In the embodiment of the application, besides the authentication for the embedded webpage, the necessary running environment is required to be deployed, so that the embedded webpage can be normally loaded in the environment similar to the mobile terminal. For example, taking Linux WMPF as an example, since in Linux WMPF, web-view is running in iframe with a certain gap from system native components of mobile terminal, extension injection script function can be used to achieve the environment with iframe having native components similar to those of original components by simulating environment before source code is executed.
Specifically, after the first simulation script is injected, an information modification function tag can be created for the target page through the first simulation script, and the information modification function tag is injected into the source code. Further, the information modification script specified by the information modification function tag may be run, and the following modification may be made to simulate the native environment.
(1) Modifying object proxy identification
Specifically, an object agent identifier is added to the obtained login information, and the login information with the object agent identifier is sent to the source code, so that the source code is executed based on the login information with the object agent identifier.
The object Agent (User Agent) identifier is an identifier of a host where a light application is located, and in general, a User identifier in the light application is specially customized for a host client, for example, includes a MicroMessager string, so in order to enable the native environment of the client to be simulated, the User Agent may be modified so as to be consistent with the original host client or modified into a specific identifiable identifier.
Referring to the following example, to illustrate a logical process for modifying a User Agent, the process may allow source code to identify the modified User Agent by defining a navigator.
(2) Modifying screen size parameters
Specifically, a target window size that is a target page may be determined based on obtaining an actual screen size of the current device, and the target window size is transmitted to the source code such that the source code is executed based on the target window size.
In general, in a browser, "window. Screen" is an object that the browser opens to describe the screen size of a web page, and because of the wide variety of operating environments under the Linux applet hardware framework, the browser size needs to be uniformly constrained to avoid the situation that normal display cannot be performed. Also, the screen size environment may be simulated in advance by injecting a script tag before the source code.
Referring to the following example, for a logical process example of simulating a screen size environment, the object of the screen size constraint is achieved by defining the acquisition attribute method of the window.
Taking Linux applet hardware framework as an example, the loading of applet web-view can be achieved by a flow as shown in fig. 10.
Step 1001: a page frame is created.
Specifically, when an applet interface containing web-view is opened, a corresponding page frame is automatically created.
Step 1002: content script is injected into the page frame.
Specifically, the interface injection of call chromium extension injects the simulated script file content. Js into the page frame.
Step 1003: and judging whether the current page is a web-view page or not.
Specifically, according to the method for classifying frames according to the hierarchical identifier, whether the current page frame is webview type.
Step 1004: if the determination in step 1003 is yes, inserting a script tag, and performing authentication.
Step 1005: and judging whether the current page has authority loading.
Specifically, the authentication code may be executed by the above-described manner of creating a script tag (authentication function tag) to be injected into html, and whether or not there is authority to load the page is confirmed by a request of the authentication code.
If the determination result in step 1003 is no, no processing is performed, and the flow ends.
Step 1006: if the determination result in step 1003 is no, that is, the authentication result is loading prohibition, the location prohibition frame is modified.
Specifically, the frame is not loaded any more by modifying the widnow.
Step 1007: if the determination in step 1003 is yes, that is, the authentication result is that the current frame has permission to be loaded, the source code of the page frame is executed.
Through the capability of Chromium Extension, the function of web-view in Linux WMPF is realized, including custom JS injection through content script of Extension, and secure communication link between web-view and applet framework through message channel of chrome.
Referring to fig. 11, based on the same inventive concept, an embodiment of the present application further provides a web page loading device 110 in a light application, where the device includes:
a script injection unit 1101 for injecting a first simulation script into the target page frame based on creation of the target page frame; the target page framework corresponds to a target page of a target light application running in the browser, and the first simulation script is used for providing a required running environment for a network view type page in the target light application;
An authentication tag injection unit 1102, configured to run a first simulation script, create an authentication function tag for a target page when it is determined that the target page frame belongs to a network view type, and inject the authentication function tag into a source code corresponding to the target page frame;
an authentication unit 1103, configured to run an authentication script specified by an authentication function tag, and authenticate the loading authority of the target page frame to obtain a corresponding authentication result;
and the execution unit 1104 is used for executing the source code and displaying the target page in the target light application if the authentication result indicates that the target page frame is allowed to be loaded.
Optionally, the browser includes a running environment simulation plug-in, and if a main configuration file of the running environment simulation plug-in indicates a page frame condition and an injection position of the first simulation script to be injected, the script injection unit 1101 is specifically configured to:
and triggering an operation environment simulation plug-in based on the creation of the target page frame, and injecting a first simulation script at a corresponding position of the target page frame according to the injection position indicated by the main configuration file when the target page frame meets the page frame condition.
Optionally, the page frame condition includes a main page frame and an inline page frame of the target light application, and a main page frame and an inline page frame of the browser, and the injection position is a start position of a source code of the page frame; the script injection unit 1101 is specifically configured to:
Based on the creation of the target page frame, the running environment simulation plug-in determines that the target page frame accords with the page frame condition; the method comprises the steps of,
a first simulation script is injected at a starting location of source code of the target page frame such that the first simulation script can run before the source code.
Optionally, the authentication unit 1103 is specifically configured to:
obtaining a page resource address of a target page and login information of a target light application;
and running an authentication script, and authenticating the loading authority of the target page frame based on the page resource address and login information.
Optionally, the apparatus further comprises a secure channel establishing unit 1105 for:
calling an event state interface of a window object, and establishing a first communication channel between a first simulation script and a target page frame;
calling a message channel interface of a browser, and creating a first message channel between a first simulation script and an operation environment simulation plug-in;
calling a message channel interface, and creating a second message channel between a second simulation script of a light application page frame included in the target light application and an operation environment simulation plug-in;
and calling an event state interface, and establishing a second communication channel between the second simulation script and the light application page framework.
Optionally, the authentication unit 1103 is specifically configured to:
invoking a second simulation script, and receiving login information in a light application page frame sent through a second communication channel;
calling an operation environment simulation plug-in, receiving login information sent by a second simulation script through a second message channel, and sending the login information to a first simulation script through a first message channel;
calling a first simulation script, and sending login information to an authentication script through a first communication channel;
and calling an authentication script to acquire the page resource address from the source code.
Optionally, the first simulation script includes a page type obtaining method, and the authentication tag is injected into the unit 1102, specifically for:
calling a page type acquisition method to acquire a target level identifier of a target page in a browser; the hierarchy identifier is used for representing the hierarchy of the corresponding page in the browser page;
calling a page type acquisition method, and determining a target page type of a target page frame based on a target level identification;
when the target page type belongs to the network view type, an authentication function label is created for the target page, and the authentication function label is injected into a source code corresponding to the target page frame.
Optionally, the execution unit 1104 is further configured to:
and if the authentication result indicates that loading of the target page frame is forbidden, calling an authentication script to modify the hypertext reference attribute of the page orientation object into other contents different from the page resource address of the target page.
Optionally, the apparatus further comprises an information modification unit 1106 for:
creating an information modification function label for the target page through the first simulation script, and injecting the information modification function label into a source code;
running an information modification script designated by an information modification function label, adding an object agent identifier for the obtained login information, and sending the login information with the object agent identifier added to a source code, so that the source code is executed based on the login information with the object agent identifier added; the method comprises the steps of,
the target window size is determined as a target page based on the obtained actual screen size of the current device, and the target window size is transmitted to the source code such that the source code is executed based on the target window size.
By the device, when the target page in the target light application is opened in the browser environment, namely after the target page frame is created for the target page, the first simulation script is injected into the target page frame, the first simulation script is used for providing a required operation environment for the page of the network view type, so that the first simulation script is operated, when the target page frame is determined to belong to the network view type, an authentication function tag is created for the target page, the authentication function tag is injected into a source code corresponding to the target page frame, the authentication script appointed by the authentication function tag is operated, the loading authority of the target page frame is authenticated, if the authentication result indicates that the target page frame is allowed to be loaded, the source code is executed, so that the target page is displayed in the target light application, in this way, the authentication operation can be completed before the source code corresponding to the target page is executed, the source code is continuously loaded when the authority loading is ensured, and the safe loading of the target page is realized.
The apparatus may be used to perform the methods shown in the embodiments of the present application, and therefore, the description of the foregoing embodiments may be referred to for the functions that can be implemented by each functional module of the apparatus, and the like, which are not repeated.
Referring to fig. 12, based on the same technical concept, an embodiment of the present application further provides a computer device 120, where the computer device 120 may be a terminal device or a server shown in fig. 1, and the computer device 120 may include a memory 1201 and a processor 1202.
The memory 1201 is used for storing a computer program executed by the processor 1202. The memory 1201 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for at least one function, and the like; the storage data area may store data created according to the use of the computer device, etc. The processor 1202 may be a central processing unit (central processing unit, CPU), or a digital processing unit, or the like. The specific connection medium between the memory 1201 and the processor 1202 is not limited in this embodiment of the application. In the embodiment of the present application, the memory 1201 and the processor 1202 are connected by the bus 1203 in fig. 12, the bus 1203 is shown by a thick line in fig. 12, and the connection manner between other components is only schematically illustrated, which is not limited thereto. The bus 1203 may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, only one thick line is shown in fig. 12, but not only one bus or one type of bus.
Memory 1201 may be a volatile memory (RAM), such as random-access memory; the memory 1201 may also be a non-volatile memory (non-volatile memory), such as a read-only memory, a flash memory (flash memory), a Hard Disk Drive (HDD) or a Solid State Drive (SSD), or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 1201 may be a combination of the above memories.
A processor 1202 for executing the methods executed by the apparatus in the embodiments of the present application when calling the computer program stored in the memory 1201.
In some possible implementations, aspects of the methods provided by the present application may also be implemented in the form of a program product comprising program code for causing a computer device to carry out the steps of the methods according to the various exemplary embodiments of the application described above when the program product is run on the computer device, for example, the computer device may carry out the methods performed by the devices in the various embodiments of the application.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (15)

1. A method for loading web pages in a lightweight application, the method comprising:
injecting a first simulation script into a target page frame based on creation of the target page frame; the target page framework corresponds to a target page of a target light application running in the browser, and the first simulation script is used for providing a required running environment for a network view type page in the target light application;
running the first simulation script, when the target page frame is determined to belong to a network view type, creating an authentication function label for the target page, and injecting the authentication function label into a source code corresponding to the target page frame;
running an authentication script appointed by the authentication function label, and authenticating the loading authority of the target page frame to obtain a corresponding authentication result;
and if the authentication result indicates that the target page frame is allowed to be loaded, executing the source code, and displaying the target page in the target light application.
2. The method of claim 1, wherein the browser comprises a runtime simulation plug-in, a main configuration file of the runtime simulation plug-in indicating page frame conditions and injection locations for which the first simulation script is to be injected;
Injecting a first simulation script into a target page frame based on creation of the target page frame, comprising:
and triggering the operation environment simulation plug-in based on the creation of the target page frame, and injecting the first simulation script at the corresponding position of the target page frame according to the injection position indicated by the main configuration file when the target page frame meets the page frame condition.
3. The method of claim 2, wherein the page frame conditions include a home page frame and an inline page frame of the target light application, and a home page frame and an inline page frame of the browser, and wherein the injection location is a start location of a source code of a page frame;
triggering the operation environment simulation plug-in based on the creation of the target page frame, and when the target page frame meets the page frame condition, injecting the first simulation script at the corresponding position of the target page frame according to the injection position indicated by the main configuration file, wherein the operation environment simulation plug-in comprises:
based on the creation of the target page frame, the running environment simulation plugin determines that the target page frame meets the page frame condition; the method comprises the steps of,
And injecting the first simulation script at the starting position of the source code of the target page frame so that the first simulation script can run before the source code.
4. The method of claim 2, wherein running the authentication script specified by the authentication function tag authenticates the loading rights of the target page frame, comprising:
acquiring a page resource address of the target page and login information of the target light application;
and running the authentication script, and authenticating the loading authority of the target page frame based on the page resource address and the login information.
5. The method of claim 4, wherein prior to obtaining the page resource address of the target page and the login information of the target light application, the method further comprises:
calling an event state interface of a window object, and establishing a first communication channel between the first simulation script and the target page frame;
calling a message channel interface of the browser, and creating a first message channel between the first simulation script and the running environment simulation plug-in;
calling the message channel interface, and creating a second message channel between a second simulation script injected into a light application page framework included by the target light application and the running environment simulation plug-in;
And calling the event state interface, and establishing a second communication channel between the second simulation script and the light application page framework.
6. The method of claim 4, wherein obtaining the page resource address of the target page and the login information of the target light application comprises:
invoking the second simulation script, and receiving login information in the light application page frame sent through the second communication channel;
calling the operation environment simulation plug-in, receiving the login information sent by the second simulation script through the second message channel, and sending the login information to the first simulation script through the first message channel;
invoking the first simulation script, and sending the login information to the authentication script through the first communication channel;
and calling the authentication script to acquire the page resource address from the source code.
7. The method of claim 1, wherein the first simulation script comprises a page type acquisition method;
running the first simulation script, when the target page frame is determined to belong to the network view type, creating an authentication function tag for the target page, and injecting the authentication function tag into a source code corresponding to the target page frame, wherein the steps include:
Calling the page type obtaining method to obtain a target level identifier of the target page in the browser; the hierarchy identifier is used for representing the hierarchy of the corresponding page in the browser page;
calling the page type acquisition method, and determining the target page type of the target page frame based on the target level identification;
and when the target page type belongs to a network view type, creating an authentication function label for the target page, and injecting the authentication function label into a source code corresponding to the target page frame.
8. The method of claim 1, wherein after running the authentication script specified by the authentication function tag to authenticate the loading right of the target page frame, obtaining a corresponding authentication result, the method further comprises:
and if the authentication result indicates that loading of the target page frame is forbidden, calling the authentication script to modify the hypertext reference attribute of the page orientation object into other contents different from the page resource address of the target page.
9. The method of any of claims 1-8, wherein prior to said executing said source code to display said target page in said target light application, said method further comprises:
Creating an information modification function tag for the target page through the first simulation script, and injecting the information modification function tag into the source code;
running an information modification script designated by the information modification function label, adding an object agent identifier for the obtained login information, and sending the login information with the object agent identifier added to the source code, so that the source code is executed based on the login information with the object agent identifier added; the method comprises the steps of,
determining a target window size of the target page based on the obtained actual screen size of the current device, and transmitting the target window size to the source code, so that the source code is executed based on the target window size.
10. A web page loading device within a lightweight application, the device comprising:
the script injection unit is used for injecting a first simulation script into the target page frame based on the creation of the target page frame; the target page framework corresponds to a target page of a target light application running in the browser, and the first simulation script is used for providing a required running environment for a network view type page in the target light application;
The authentication tag injection unit is used for running the first simulation script, creating an authentication function tag for the target page when the target page frame is determined to belong to a network view type, and injecting the authentication function tag into a source code corresponding to the target page frame;
the authentication unit is used for running an authentication script appointed by the authentication function label, authenticating the loading authority of the target page frame and obtaining a corresponding authentication result;
and the execution unit is used for executing the source code and displaying the target page in the target light application if the authentication result indicates that the target page frame is allowed to be loaded.
11. The apparatus of claim 10, wherein the first simulation script includes a page type acquisition method, and the authentication tag injection unit is specifically configured to:
calling the page type obtaining method to obtain a target level identifier of the target page in the browser; the hierarchy identifier is used for representing the hierarchy of the corresponding page in the browser page;
calling the page type acquisition method, and determining the target page type of the target page frame based on the target level identification;
And when the target page type belongs to a network view type, creating an authentication function label for the target page, and injecting the authentication function label into a source code corresponding to the target page frame.
12. The apparatus of claim 10, wherein the execution unit is further to:
and if the authentication result indicates that loading of the target page frame is forbidden, calling the authentication script to modify the hypertext reference attribute of the page orientation object into other contents different from the page resource address of the target page.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that,
the processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 9.
14. A computer storage medium having a computer program stored thereon, characterized in that,
the computer program implementing the steps of the method of any one of claims 1 to 9 when executed by a processor.
15. A computer program product comprising a computer program, characterized in that,
the computer program implementing the steps of the method of any one of claims 1 to 9 when executed by a processor.
CN202210186267.9A 2022-02-28 2022-02-28 Webpage loading method, device and equipment in light application and computer storage medium Pending CN116702147A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210186267.9A CN116702147A (en) 2022-02-28 2022-02-28 Webpage loading method, device and equipment in light application and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210186267.9A CN116702147A (en) 2022-02-28 2022-02-28 Webpage loading method, device and equipment in light application and computer storage medium

Publications (1)

Publication Number Publication Date
CN116702147A true CN116702147A (en) 2023-09-05

Family

ID=87843839

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210186267.9A Pending CN116702147A (en) 2022-02-28 2022-02-28 Webpage loading method, device and equipment in light application and computer storage medium

Country Status (1)

Country Link
CN (1) CN116702147A (en)

Similar Documents

Publication Publication Date Title
US20190327287A1 (en) Data acquisition method and device
CN105940654B (en) Franchise static web application in trust
US8843820B1 (en) Content script blacklisting for use with browser extensions
CN105791324B (en) Account login method and device
KR20190005855A (en) Page component dynamic layout
CN111159614B (en) Webpage resource acquisition method and device
US20160142413A1 (en) Ephemeral applications
CN108108219B (en) Application program running method and device, computer equipment and storage medium
US20140317537A1 (en) Browser based application program extension method and device
CN112637361B (en) Page proxy method, device, electronic equipment and storage medium
CN108399119B (en) Method and device for data processing and automatic testing of browsing service kernel engine
US20140095974A1 (en) Secure html javascript code snippet usage in application integration
CN109522500B (en) Webpage display method, device, terminal and storage medium
CN103036871A (en) Support device and method of application plug-in of browser
CN106569856A (en) Method and device of loading application view resource file
CN108021564A (en) A kind of method and apparatus of page reorientation
CN111767109A (en) H5 page display method, device and readable storage medium based on terminal application
CN112818270A (en) Data cross-domain transfer method and device and computer equipment
CN107391182B (en) Generation method, device, server and storage medium of theme installation package
CN111079048A (en) Page loading method and device
US9223557B1 (en) Application provided browser plugin
CN105786476B (en) Data processing method and system between mobile client and server
CN108509228B (en) Page loading method, terminal equipment and computer readable storage medium
CN111563215B (en) Method and device for controlling front-end operation authority and related equipment
CN116702147A (en) Webpage loading method, device and equipment in light application and computer storage medium

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