CN103927151B - The method and apparatus that local operation is realized on web page - Google Patents

The method and apparatus that local operation is realized on web page Download PDF

Info

Publication number
CN103927151B
CN103927151B CN201310011380.4A CN201310011380A CN103927151B CN 103927151 B CN103927151 B CN 103927151B CN 201310011380 A CN201310011380 A CN 201310011380A CN 103927151 B CN103927151 B CN 103927151B
Authority
CN
China
Prior art keywords
local
interface
resource
web page
javascript
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.)
Active
Application number
CN201310011380.4A
Other languages
Chinese (zh)
Other versions
CN103927151A (en
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.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing 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 Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN201310011380.4A priority Critical patent/CN103927151B/en
Priority to US14/153,484 priority patent/US20140201619A1/en
Publication of CN103927151A publication Critical patent/CN103927151A/en
Application granted granted Critical
Publication of CN103927151B publication Critical patent/CN103927151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of method and apparatus that local operation is realized on web page, belong to web technology field.The method is applied in an electronic equipment, which includes a display unit and have HTML running environment, the described method includes:Web page is loaded by address information in HTML running environment;During loading page, the identification information of the situation for the local resource for being used to characterize the electronic equipment is obtained;Operation requests are obtained, which is used for the request for characterizing the first resource of operation local resource;According to the operation requests, which is responded with first resource;Show that first resource responds the response results of the operation requests on the display unit.Described device includes:Loading unit, acquiring unit, response unit and display unit.The present invention realizes execution local operation on web page, improves the local call capability of javascript codes.

Description

The method and apparatus that local operation is realized on web page
Technical field
The present invention relates to web technology field, more particularly to a kind of method and dress that local operation is realized on web page Put.
Background technology
JavaScript is a kind of client-side scripting language based on object and event-driven and with relative safety, extensively The general Web applied to client is developed.JavaScript is commonly used to hypertext markup language(English:HyperText Markup Language, abbreviation:HTML)Webpage adds dynamic function, for example respond the various operations of user etc., JavaScript can be used for other occasions, such as Server Programming.
JavaScript engine is the interpreter that can read and perform JavaScript source code, and it is clear to be now chiefly used in webpage Look in device, such as the Nitro of Apple Safari4, V8 the and Mozilla Firefox3.5's of Chrome browsers TraceMonkey etc..
In Chrome browsers, it is responsible for parsing by Javascript engines V8 and runs Javascript codes.Wherein, Javascript engines V8 operates in rendering for Chrome browsers(English:render)Under process, for the purpose of safety, lead to Among the render processes often are inserted sandbox, it can only be run with limiting Javascript codes in sandbox, so as to improve clear Look at the security of device.
But since Javascript codes can only be run in sandbox, the javascript generations on web page The ability that code execution is locally called is very faint, can not also realize the access to local file at present.
The content of the invention
In order to improve the local call capability of javascript codes, realized the present invention provides one kind on web page The method and apparatus of local operation.The technical solution is as follows:
On the one hand, the present invention provides a kind of method that local operation is realized on web page, the method to be applied to one In electronic equipment, the electronic equipment includes a display unit and the electronic equipment and is transported with hypertext markup language HTML Row environment, the described method includes:
Web page is loaded by address information in the HTML running environment;
During the web page is loaded, the situation for the local resource for being used to characterize the electronic equipment is obtained Identification information;
Operation requests are obtained, the operation requests are used for the request for characterizing the first resource for operating the local resource;
According to the operation requests, the operation requests are responded with the first resource;
Show that the first resource responds the response results of the operation requests on the display unit.
Wherein, according to the operation requests, the operation requests are responded with the first resource, including:
It is described when javascript engines are being resolved to the corresponding first interface of the operation requests in rendering process Javascript engines are used to explain javascript scripts, and the first interface is to connect based on javascript is customized Mouthful, for operating the first resource on web page, and the first interface is registered with the javascript engines, Then the javascript engines send interprocess communication IPC message according to the first interface to host process, ask described The local first resource is operated on web page;
In the host process, institute is operated on the web page according to the received IPC message calls local interface State local first resource;
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
Wherein, the javascript engines send IPC message according to the first interface to host process, ask described The local first resource is operated on web page, including:
The first interface is mapped as the local function that renders process and can run by the javascript engines;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
Wherein, the method further includes:
Before the javascript engines send interprocess communication IPC message according to the first interface to host process, Judge whether the web page has the authority of operation local resource according to default white list;
If it is determined that the web page has the authority of operation local resource, then the javascript engines root is performed The step of according to the first interface to the host process transmission IPC message.
On the other hand, present invention also offers a kind of method that local operation is realized on web page, the method application In an electronic equipment, the electronic equipment has hypertext markup language HTML running environment, the described method includes:
When opening a web page in the HTML running environment, javascript engines are right in process is rendered The web page is parsed;
When the javascript engines are resolved to first interface, the first interface is to be made by oneself based on javascript The interface of justice, described the is registered with for operating local first resource on web page, and in the javascript engines One interface, then the javascript engines according to the first interface to host process send interprocess communication IPC message, request The local first resource is operated on the web page;
In the host process, institute is operated on the web page according to the received IPC message calls local interface State local first resource;
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
Wherein, the javascript engines send interprocess communication IPC message according to the first interface to host process, Request operates the local first resource on the web page, including:
The first interface is mapped as the local function that renders process and can run by the javascript engines;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
Wherein, the method further includes:
Before the javascript engines send interprocess communication IPC message according to the first interface to host process, Judge whether the web page has the authority of operation local resource according to default white list;
If it is determined that the web page has the authority of operation local resource, then the javascript engines root is performed The step of according to the first interface to the host process transmission IPC message.
Wherein, in the host process, according to the received IPC message calls local interface on the web page The local first resource is operated, including:
In the host process, the IPC message received to the host process filters, and confirms the IPC message After message for host process processing, described is operated on the web page according to the IPC message calls local interface The first resource on ground.
Another further aspect, present invention also offers a kind of device that local operation is realized on web page, applied to an electronics In equipment, the electronic equipment has hypertext markup language HTML running environment, and described device includes:
Loading unit, for loading web page by address information in the HTML running environment;
Acquiring unit, for during the web page is loaded, obtaining the local for being used for characterizing the electronic equipment The identification information of the situation of resource;
Response unit, for obtaining operation requests, the operation requests, which are used to characterize, operates the first of the local resource The request of resource;According to the operation requests, the operation requests are responded with the first resource;
Display unit, for showing that the first resource responds the response results of the operation requests.
Wherein, the response unit includes:
Javascript engines, for when being resolved to the corresponding first interface of the operation requests in rendering process, The javascript engines are used to explain javascript scripts, and the first interface is customized based on javascript Interface, registers with described first for operating the first resource on web page, and in the javascript engines and connects Mouthful, then interprocess communication IPC message is sent to host process according to the first interface, ask to operate institute on the web page State local first resource;
It is local to call subelement, in the host process, being existed according to the received IPC message calls local interface The local first resource is operated on the web page;
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
Wherein, the javascript engines are used for:
The first interface is mapped as the local function that renders process and can run;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
Wherein, the javascript engines are additionally operable to:
Before sending interprocess communication IPC message to host process according to the first interface, sentenced according to default white list Whether the web page that breaks has the authority of operation local resource;
If it is determined that the web page has the authority of operation local resource, then the javascript engines root is performed The step of according to the first interface to the host process transmission IPC message.
Another aspect, present invention also offers a kind of device that local operation is realized on web page, applied to an electronics In equipment, the electronic equipment has hypertext markup language HTML running environment, and described device includes:
Javascript engines, for when opening a web page in the HTML running environment, rendering process In the web page is parsed;When being resolved to first interface, the first interface is self-defined based on javascript Interface, for operating local first resource on web page, and described first is registered with the javascript engines Interface, then send interprocess communication IPC message to host process according to the first interface, ask to operate on the web page The local first resource;
Local calling module, in the host process, according to the received IPC message calls local interface in institute State and the local first resource is operated on web page;
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
Wherein, the javascript engines are used for:
The first interface is mapped as the local function that renders process and can run;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
Wherein, the javascript engines are additionally operable to:
Before sending interprocess communication IPC message to host process according to the first interface, sentenced according to default white list Whether the web page that breaks has the authority of operation local resource;
If it is determined that the web page has the authority of operation local resource, then perform according to the first interface to master Process sends the step of IPC message.
Wherein, the local calling module is used for:
In the host process, the IPC message received to the host process filters, and confirms the IPC message After message for host process processing, described is operated on the web page according to the IPC message calls local interface The first resource on ground.
The beneficial effect that technical solution provided by the invention is brought is:On the one hand, when passing through ground in HTML running environment During the information loading web page of location, the identification information of the situation for the local resource for being used to characterize the electronic equipment is obtained, and grasped Ask, which is used for the request for characterizing the first resource of operation local resource, and responding the operation with first resource please Ask, show that first resource responds the response results of the operation requests on the display unit, realize on web page to local money The access and operation in source, improve the local call capability of javascript codes.On the other hand, when in HTML running environment During one web page of middle opening, javascript engines are after registered first interface is resolved in rendering process, Xiang Zhujin Journey sends IPC message, asks to operate local first resource on web page;In host process, according to the IPC message calls Local interface operates local first resource on web page, obtains the operation on the web page to local first resource Response, improves the local call capability of javascript codes, compared with prior art, web page can be opened local The interface of calling, adds the local operation function of web page, and the javascript self defined interfaces are not limited to read file Or operating writing-file, it can as needed be designed as performing various local operations, flexibly and easily, be widely used.
Brief description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for For those of ordinary skill in the art, without creative efforts, other can also be obtained according to these attached drawings Attached drawing.
Fig. 1 is the method flow diagram that local operation is realized on web page that one embodiment of the invention provides;
Fig. 2 is the method flow diagram that local operation is realized on web page that further embodiment of this invention provides;
Fig. 3 is the method flow diagram that local operation is realized on web page that another embodiment of the present invention provides;
Fig. 4 is the schematic diagram provided in an embodiment of the present invention that local operation is realized by interaction between process;
Fig. 5 is the structure drawing of device that local operation is realized on web page that one embodiment of the invention provides;
Fig. 6 is the structure drawing of device that local operation is realized on web page that another embodiment of the invention provides.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
The present embodiments relate to HTML running environment.The HTML running environment refers to the multi-process with safeguard protection Running environment.In HTML running environment, presentation engine is responsible for that html document is presented and picture, javascript engines are responsible for Explain javascript scripts.The presentation engine such as webkit, Gecko etc..The multi-process refers to run ring in HTML Multiple processes can be run at the same time to perform task, which includes but not limited to render in border(render)Process, master (browser)Process etc..The render processes referred to safeguard protection in the HTML running environment are in protection shape State, without the authority for calling local interface.For example, it is placed in sandbox(sandbox)Among, in accordance with minimum license principle, often The authority of one processing action can all be limited, and is only capable of computing but can not be write archives or read archives from sensitizing range, Such as my file, desktop, the Javascript codes limited with this in web page can only be run in sandbox, Malware It will be unable to steal credit card number, interference mouse running etc., so as to improve security.The HTML running environment can be to browse Device, the browser include but not limited to Chrome browsers etc..
Referring to Fig. 1, one embodiment of the invention provides a kind of method that local operation is realized on web page, is applied to In one electronic equipment, which includes a display unit, and the electronic equipment has HTML running environment, this method bag Include:
101:Web page is loaded by address information in the HTML running environment.
102:During the web page is loaded, the situation for the local resource for being used to characterize the electronic equipment is obtained Identification information.
103:Operation requests are obtained, the operation requests are used for the request for characterizing the first resource of operation local resource.
104:According to the operation requests, which is responded with the first resource.
105:Show that the first resource responds the response results of the operation requests on the display unit.
In one embodiment of the above method, specifically, step 102 can include:
During the web page is loaded, when javascript engines are resolved to second interface in process is rendered When, the javascript engines are used to explain javascript scripts, and the second interface is to be made by oneself based on javascript The interface of justice, the identification information of the situation for obtaining the local resource for being used to characterize the electronic equipment, and it is described The second interface is registered with javascript engines, then the javascript engines according to the second interface to it is main into Journey sends interprocess communication IPC message, identification information described in acquisition request;In the host process, according to the received IPC Message call local interface obtains the identification information.
Correspondingly, in the above method, the corresponding display interface of the web page can be shown on the display unit, Also, after the operation requests are responded according to the operation requests with the first resource, in the display interface described in display Response results.
In another embodiment of the above method, specifically, the web page pair can be first shown on the display unit The display interface answered, shows the identification information in the display interface.Wherein, the identification information includes at least and the first money The corresponding first flag in source, can also further include more identifying, second identifier such as corresponding with Secondary resource, or The 3rd mark corresponding with information resources etc..The operation requests can identify whether to be touched by detecting on display interface Acquisition is sent, such as when detecting that the first flag on display interface is triggered, obtains operation requests, which is used for table The request of the first resource of sign operation local resource.After the operation requests are responded with first resource, in the display interface Show the response results.
In the present embodiment, according to the operation requests, the operation requests are responded with the first resource, including:
It is described when javascript engines are being resolved to the corresponding first interface of the operation requests in rendering process Javascript engines are used to explain javascript scripts, and the first interface is to connect based on javascript is customized Mouthful, for operating the first resource on web page, and the first interface is registered with the javascript engines, Then the javascript engines send interprocess communication IPC message according to the first interface to host process, ask described The local first resource is operated on web page;
In the host process, institute is operated on the web page according to the received IPC message calls local interface State local first resource;
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
Further, the javascript engines send IPC message according to the first interface to host process, ask The local first resource is operated on the web page, including:
The first interface is mapped as the local function that renders process and can run by the javascript engines;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
In the present embodiment, the method further includes:
Before the javascript engines send interprocess communication IPC message according to the first interface to host process, Judge whether the web page has the authority of operation local resource according to default white list;
If it is determined that the web page has the authority of operation local resource, then the javascript engines root is performed The step of according to the first interface to the host process transmission IPC message.
The above method provided in this embodiment, when loading web page by address information in HTML running environment, is obtained It must be used for the identification information for characterizing the situation of the local resource of the electronic equipment, and obtain operation requests, which is used for The request of the first resource of characterization operation local resource, responds the operation requests with first resource, shows the on the display unit The response results of the one resource response operation requests, realize access and operation to local resource on web page, improve The local call capabilities of javascript codes.
Referring to Fig. 2, further embodiment of this invention provides a kind of method that local operation is realized on web page, application In an electronic equipment, which has HTML running environment, and this method includes:
201:When opening a web page in the HTML running environment, javascript engines are rendering process In the web page is parsed.
202:When javascript engines are resolved to first interface, which is self-defined based on javascript Interface, for operating local first resource on web page, and the first interface is registered with javascript engines, Then javascript engines send IPC message according to the first interface to host process, ask to operate on the web page local First resource.
203:In the host process, this is operated on the web page according to received IPC message calls local interface The first resource on ground.
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
In the present embodiment, the javascript engines send interprocess communication according to the first interface to host process IPC message, asks to operate the local first resource on the web page, including:
The first interface is mapped as the local function that renders process and can run by the javascript engines;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
In the present embodiment, the method further includes:
Before the javascript engines send interprocess communication IPC message according to the first interface to host process, Judge whether the web page has the authority of operation local resource according to default white list;
If it is determined that the web page has the authority of operation local resource, then the javascript engines root is performed The step of according to the first interface to the host process transmission IPC message.
In the present embodiment, described is operated on the web page according to the received IPC message calls local interface The first resource on ground, including:
In the host process, the IPC message received to the host process filters, and confirms the IPC message After message for host process processing, described is operated on the web page according to the IPC message calls local interface The first resource on ground.
The above method provided in this embodiment, when opening a web page in HTML running environment, javascript Engine sends IPC message after registered first interface is resolved in rendering process, to host process, asks on web page Operate local first resource;In host process, local is operated on web page according to the IPC message call local interfaces First resource, is responded the operation on the web page to local first resource, improves javascript codes Local call capability, compared with prior art, can open the interface locally called to web page, add the local of web page Operating function, the javascript self defined interfaces are not limited to read file or operating writing-file, can set as needed It is calculated as performing various local operations, flexibly and easily, is widely used.
Referring to Fig. 3, another embodiment of the present invention provides a kind of method that local operation is realized on web page, application In an electronic equipment, which has HTML running environment, and this method specifically includes:
301:In advance to javascript engine registers first interfaces in HTML running environment, wherein, it is described Javascript engines are used to explain javascript scripts, the first interface be based on the customized interfaces of javascript, For operating local first resource on web page.
Wherein, first interface is pre-designed, its function is that local first resource is operated on web page.The web The page refers to the page of HTML running environment processing, the html pages such as currently shown.The local first resource refers to The file that is preserved on local client, executable program etc..The local first resource of the operation, includes but not limited to:Read Take the file in the client, the written document in the client, perform an executable program, enable one in the client Service or disable service in the client etc..
302:When opening a web page in HTML running environment, javascript engines are right in process is rendered The web page is parsed.
HTML running environment in the present embodiment is multi-process running environment, and the multi-process includes but not limited to:Render Process, master(browser)Process etc..Wherein, javascript is engine-operated in process is rendered, for example, Chrome is browsed The javascript engines V8 of device is operated in render processes.Javascript engines are mainly used in web page Javascript scripts are parsed.
303:When javascript engines are resolved to the registered first interface, javascript engines are according to pre- If white list judge the web page whether have operation local resource authority.
In the present embodiment, the white list is pre-set list, wherein record has the power with operation local resource The source-information of the web page of limit.Specifically, it can be determined that the source-information of the web page whether is recorded in the white list, If it is, determine that the web page has the authority of operation local resource, otherwise, it determines the web page does not operate local money The authority in source.The authority of web page operation local resource can be strictly controlled by white list, so as to enhance security.
304:If it is determined that the web page has the authority of operation local resource, then by first interface be mapped as rendering into The local function that journey can be run.
In general, rendering the various local functions that can be run in process in local function library, these functions are usually C++ letters Number, can perform various functions.Above-mentioned first interface needs to be mapped as corresponding local function, could be transported in process is rendered OK.
305:The local function is run, IPC message is sent to host process, asks to operate local first on web page Resource.
In the present embodiment, due to rendering among process is located at sandbox, in guard mode, local various connect can not be called Mouth is to operate local resource, therefore, renders process and the request for operating local resource is sent to host process, to ask host process to be grasped Make local resource.
The IPC message is mainly used for the communication between process, and the type of message also has many kinds, this step uses IPC Message is used for the request that operation local resource is sent to host process, and the form of specific IPC message does not do excessive explanation then.
306:In the host process, IPC message received to host process filters, in the IPC that filtering acknowledges receipt of After message of the message for host process processing, local the is operated on the web page according to the IPC message calls local interface One resource.
In general, host process can receive many message, various message, come from different processes, some message categories In the message of host process processing, some message are not the message of host process processing as broadcast the message, therefore, in order to improve processing effect Rate, host process can filter received message, so as to select the message to one's name handled.
Wherein, host process is in nonprotected state, has the authority for calling local interface.Therefore, can in host process, To local API(Application Programming Interface, application programming interfaces)It is called, so as to fulfill Operate local resource.The result of execution is returned to the process of rendering by host process after the local first resource of operation.
It is provided in this embodiment by being handed between process referring to Fig. 4 in order to which the implementation procedure of the above method is better described Mutually realize the schematic diagram of local operation.Wherein, illustrated so that HTML running environment is chromium browsers as an example, browser A javascript self defined interface is contained on the web page being currently running, for client sheet where opening browser One exe file on ground.Realize that the flow for performing local operation is as follows:1. javascript engines V8 is rendering render processes In the javascript codes on web page are parsed, be resolved to a javascript self defined interface meplus.platform.lauchExe();2. the javascript self defined interfaces are mapped as render processes to hold Capable local function;3. run the local function;4. sending IPC message gives browser processes, request performs local operation;⑤ Browser processes filter received message, confirm the message that the IPC message is oneself processing, call browser processes The API that the function OnLaunchNativeExe () being able to carry out, the function call windows system provide, which is realized, to be opened locally Exe files operation.
The above method provided in this embodiment, when opening a web page in HTML running environment, javascript Engine sends IPC message after registered first interface is resolved in rendering process, to host process, asks on web page Operate local first resource;In host process, local is operated on web page according to the IPC message call local interfaces First resource, is responded the operation on the web page to local first resource, improves javascript codes Local call capability, compared with prior art, can open the interface locally called to web page, add the local of web page Operating function, the javascript self defined interfaces are not limited to read file or operating writing-file, can set as needed It is calculated as performing various local operations, flexibly and easily, is widely used.
Referring to Fig. 5, yet another embodiment of the invention provides a kind of device that local operation is realized on web page, application In an electronic equipment, which has hypertext markup language HTML running environment, and described device includes:
Loading unit 501, for loading web page by address information in the HTML running environment;
Acquiring unit 502, is used to characterize the electronic equipment for during the web page is loaded, obtaining The identification information of the situation of local resource;
Response unit 503, for obtaining operation requests, the operation requests, which are used to characterizing, operates the of the local resource The request of one resource;According to the operation requests, the operation requests are responded with the first resource;
Display unit 504, for showing that the first resource responds the response results of the operation requests.
Wherein, response unit 503 includes:
Javascript engines, for when being resolved to the corresponding first interface of the operation requests in rendering process, The javascript engines are used to explain javascript scripts, and the first interface is customized based on javascript Interface, registers with described first for operating the first resource on web page, and in the javascript engines and connects Mouthful, then interprocess communication IPC message is sent to host process according to the first interface, ask to operate institute on the web page State local first resource;
It is local to call subelement, in the host process, being existed according to the received IPC message calls local interface The local first resource is operated on the web page;
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
Further, the javascript engines are used for:
The first interface is mapped as the local function that renders process and can run;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
In the present embodiment, the javascript engines are additionally operable to:
Before sending interprocess communication IPC message to host process according to the first interface, sentenced according to default white list Whether the web page that breaks has the authority of operation local resource;
If it is determined that the web page has the authority of operation local resource, then the javascript engines root is performed The step of according to the first interface to the host process transmission IPC message.
Above device provided in this embodiment can perform the method provided in any of the above-described embodiment of the method, detailed process See the description in embodiment of the method, do not repeat herein.
Above device provided in this embodiment, when loading web page by address information in HTML running environment, is obtained It must be used for the identification information for characterizing the situation of the local resource of the electronic equipment, and obtain operation requests, which is used for The request of the first resource of characterization operation local resource, responds the operation requests with first resource, shows the on the display unit The response results of the one resource response operation requests, realize access and operation to local resource on web page, improve The local call capabilities of javascript codes.
Referring to Fig. 6, another embodiment of the present invention provides a kind of device that local operation is realized on web page, application In an electronic equipment, which has hypertext markup language HTML running environment, and described device includes:
Javascript engines 601, for when opening a web page in the HTML running environment, rendering The web page is parsed in process;When being resolved to first interface, the first interface be based on javascript from The interface of definition, registers with described for operating local first resource on web page, and in the javascript engines First interface, then send interprocess communication IPC message to host process according to the first interface, ask on the web page Operate the local first resource;
Local calling module 602, in the host process, according to the received IPC message calls local interface The local first resource is operated on the web page;
Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in Nonprotected state, has the authority for calling local interface.
Wherein, the javascript engines are used for:
The first interface is mapped as the local function that renders process and can run;
The local function is run, the IPC message is sent to the host process, asks to operate on the web page The local first resource.
Further, the javascript engines are additionally operable to:
Before sending interprocess communication IPC message to host process according to the first interface, sentenced according to default white list Whether the web page that breaks has the authority of operation local resource;
If it is determined that the web page has the authority of operation local resource, then perform according to the first interface to master Process sends the step of IPC message.
In the present embodiment, the local calling module is used for:
In the host process, the IPC message received to the host process filters, and confirms the IPC message After message for host process processing, described is operated on the web page according to the IPC message calls local interface The first resource on ground.
Above device provided in this embodiment can perform the method provided in any of the above-described embodiment of the method, detailed process See the description in embodiment of the method, do not repeat herein.
Above device provided in this embodiment, when opening a web page in HTML running environment, javascript Engine sends IPC message after registered first interface is resolved in rendering process, to host process, asks on web page Operate local first resource;In host process, local is operated on web page according to the IPC message call local interfaces First resource, is responded the operation on the web page to local first resource, improves javascript codes Local call capability, compared with prior art, can open the interface locally called to web page, add the local of web page Operating function, the javascript self defined interfaces are not limited to read file or operating writing-file, can set as needed It is calculated as performing various local operations, flexibly and easily, is widely used.
One of ordinary skill in the art will appreciate that hardware can be passed through by realizing all or part of step of above-described embodiment To complete, relevant hardware can also be instructed to complete by program, the program can be stored in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only storage, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent replacement, improvement and so on, should all be included in the protection scope of the present invention.

Claims (14)

  1. A kind of 1. method that local operation is realized on web page, it is characterised in that the method is applied to an electronic equipment In, the electronic equipment, which includes a display unit and the electronic equipment, has hypertext markup language HTML running environment, The described method includes:
    Web page is loaded by address information in the HTML running environment;
    During the web page is loaded, when javascript engines are being resolved to second interface in rendering process, institute State javascript engines to be used to explain javascript scripts, the second interface is to connect based on javascript is customized Mouthful, the identification information of the situation for obtaining the local resource for being used to characterize the electronic equipment, and the javascript engines In register with the second interface, then the javascript engines according to the second interface between host process transmission process lead to Believe IPC message, identification information described in acquisition request;In the host process, locally connect according to the received IPC message calls Mouth obtains the identification information;
    Operation requests are obtained, the operation requests are used for the request for characterizing the first resource for operating the local resource;
    According to the operation requests, the operation requests are responded with the first resource;
    Show that the first resource responds the response results of the operation requests on the display unit.
  2. 2. according to the method described in claim 1, it is characterized in that, according to the operation requests, responded with the first resource The operation requests, including:
    It is described when javascript engines are being resolved to the corresponding first interface of the operation requests in rendering process Javascript engines are used to explain javascript scripts, and the first interface is to connect based on javascript is customized Mouthful, for operating the first resource on web page, and the first interface is registered with the javascript engines, Then the javascript engines send interprocess communication IPC message according to the first interface to host process, ask described The first resource of the local resource is operated on web page;
    In the host process, described is operated on the web page according to the received IPC message calls local interface The first resource of ground resource;
    Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in non-guarantor Shield state, has the authority for calling local interface.
  3. 3. according to the method described in claim 2, it is characterized in that, the javascript engines according to the first interface to Host process sends IPC message, asks to operate the first resource of the local resource on the web page, including:
    The first interface is mapped as the local function that renders process and can run by the javascript engines;
    The local function is run, the IPC message is sent to the host process, is asked on the web page described in operation The first resource of local resource.
  4. 4. according to the method described in claim 2, it is characterized in that, the method further includes:
    Before the javascript engines send interprocess communication IPC message according to the first interface to host process, according to Default white list judges whether the web page has the authority of operation local resource;
    If it is determined that the web page has the authority of operation local resource, then the javascript engines are performed according to institute State the step of first interface is to the host process transmission IPC message.
  5. A kind of 5. method that local operation is realized on web page, it is characterised in that the method is applied to an electronic equipment In, the electronic equipment has hypertext markup language HTML running environment, the described method includes:
    When opening a web page in the HTML running environment, javascript engines are in process is rendered to described Web page is parsed;
    When the javascript engines are resolved to first interface, the first interface is customized based on javascript Interface, registers with described first for operating local first resource on web page, and in the javascript engines and connects Mouthful, then the first interface is mapped as the local function that renders process and can run by the javascript engines;Fortune The row local function, sends IPC message to host process, asks to operate the local first resource on the web page;
    In the host process, described is operated on the web page according to the received IPC message calls local interface The first resource on ground;
    Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in non-guarantor Shield state, has the authority for calling local interface.
  6. 6. according to the method described in claim 5, it is characterized in that, the method further includes:
    Before the javascript engines send interprocess communication IPC message according to the first interface to host process, according to Default white list judges whether the web page has the authority of operation local resource;
    If it is determined that the web page has the authority of operation local resource, then the javascript engines are performed according to institute State the step of first interface is to the host process transmission IPC message.
  7. 7. according to the method described in claim 5, it is characterized in that, in the host process, according to the received IPC message Local interface is called to operate the local first resource on the web page, including:
    In the host process, the IPC message received to the host process filters, and confirms the IPC message for institute After the message for stating host process processing, operated according to the IPC message calls local interface on the web page described local First resource.
  8. A kind of 8. device that local operation is realized on web page, it is characterised in that applied in an electronic equipment, the electricity Sub- equipment has hypertext markup language HTML running environment, and described device includes:
    Loading unit, for loading web page by address information in the HTML running environment;
    Acquiring unit, for during the web page is loaded, when javascript engines are resolved in process is rendered During second interface, the javascript engines are used to explain javascript scripts, the second interface be based on The customized interfaces of javascript, the identification information of the situation for obtaining the local resource for being used to characterize the electronic equipment, And registering with the second interface in the javascript engines, then the javascript engines are according to the second interface Interprocess communication IPC message, identification information described in acquisition request are sent to host process;In the host process, according to received The IPC message calls local interface obtains the identification information;
    Response unit, for obtaining operation requests, the operation requests are used to characterize the first resource for operating the local resource Request;According to the operation requests, the operation requests are responded with the first resource;
    Display unit, for showing that the first resource responds the response results of the operation requests.
  9. 9. device according to claim 8, it is characterised in that the response unit includes:
    Javascript engines, it is described for when being resolved to the corresponding first interface of the operation requests in rendering process Javascript engines are used to explain javascript scripts, and the first interface is to connect based on javascript is customized Mouthful, for operating the first resource on web page, and the first interface is registered with the javascript engines, Interprocess communication IPC message is then sent to host process according to the first interface, asks to operate described on the web page The first resource of ground resource;
    It is local to call subelement, in the host process, according to the received IPC message calls local interface described The first resource of the local resource is operated on web page;
    Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in non-guarantor Shield state, has the authority for calling local interface.
  10. 10. device according to claim 9, it is characterised in that the javascript engines are used for:
    The first interface is mapped as the local function that renders process and can run;
    The local function is run, the IPC message is sent to the host process, is asked on the web page described in operation The first resource of local resource.
  11. 11. device according to claim 9, it is characterised in that the javascript engines are additionally operable to:
    Before sending interprocess communication IPC message to host process according to the first interface, institute is judged according to default white list State whether web page has the authority of operation local resource;
    If it is determined that the web page has the authority of operation local resource, then the javascript engines are performed according to institute State the step of first interface is to the host process transmission IPC message.
  12. A kind of 12. device that local operation is realized on web page, it is characterised in that applied in an electronic equipment, the electricity Sub- equipment has hypertext markup language HTML running environment, and described device includes:
    Javascript engines, for when in the HTML running environment open a web page when, it is right in process is rendered The web page is parsed;When being resolved to first interface, the first interface is to connect based on javascript is customized Mouthful, register with described first for operating local first resource on web page, and in the javascript engines and connect Mouthful, then the first interface is mapped as the local function that renders process and can run;The local function is run, to master Process sends IPC message, asks to operate the local first resource on the web page;
    Local calling module, in the host process, according to the received IPC message calls local interface described The local first resource is operated on web page;
    Wherein, the process that renders is in guard mode, and without the authority for calling local interface, the host process is in non-guarantor Shield state, has the authority for calling local interface.
  13. 13. device according to claim 12, it is characterised in that the javascript engines are additionally operable to:
    Before sending interprocess communication IPC message to host process according to the first interface, institute is judged according to default white list State whether web page has the authority of operation local resource;
    If it is determined that the web page has the authority of operation local resource, then perform according to the first interface to host process The step of sending the IPC message.
  14. 14. device according to claim 12, it is characterised in that the local calling module is used for:
    In the host process, the IPC message received to the host process filters, and confirms the IPC message for institute After the message for stating host process processing, operated according to the IPC message calls local interface on the web page described local First resource.
CN201310011380.4A 2013-01-11 2013-01-11 The method and apparatus that local operation is realized on web page Active CN103927151B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201310011380.4A CN103927151B (en) 2013-01-11 2013-01-11 The method and apparatus that local operation is realized on web page
US14/153,484 US20140201619A1 (en) 2013-01-11 2014-01-13 Method And Device For Implementing Local Operation On Web Page

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310011380.4A CN103927151B (en) 2013-01-11 2013-01-11 The method and apparatus that local operation is realized on web page

Publications (2)

Publication Number Publication Date
CN103927151A CN103927151A (en) 2014-07-16
CN103927151B true CN103927151B (en) 2018-04-27

Family

ID=51145383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310011380.4A Active CN103927151B (en) 2013-01-11 2013-01-11 The method and apparatus that local operation is realized on web page

Country Status (1)

Country Link
CN (1) CN103927151B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107436899A (en) * 2016-05-26 2017-12-05 阿里巴巴集团控股有限公司 The implementation method and device of the vivo identification page
CN106775862A (en) * 2016-12-08 2017-05-31 蓝信工场(北京)科技有限公司 Using loading method and device
CN108268528A (en) * 2016-12-30 2018-07-10 华为技术有限公司 The processing method and terminal device of a kind of media data
CN108509228B (en) * 2017-11-10 2021-04-30 平安普惠企业管理有限公司 Page loading method, terminal equipment and computer readable storage medium
CN111027051B (en) * 2019-10-29 2021-12-17 贝壳技术有限公司 Method and device for controlling page permission calling and readable storage medium
CN113010237B (en) * 2021-03-23 2024-07-09 税友软件集团股份有限公司 Data interaction method, system, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308465A (en) * 2008-05-08 2008-11-19 华为技术有限公司 Local resource access method and device
CN101634947A (en) * 2009-08-31 2010-01-27 腾讯科技(深圳)有限公司 IE control using local resources of client and application method thereof
CN102663318A (en) * 2012-03-22 2012-09-12 百度在线网络技术(北京)有限公司 Browser and client

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6757900B1 (en) * 2000-05-18 2004-06-29 Microsoft Corporation State management of server-side control objects

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308465A (en) * 2008-05-08 2008-11-19 华为技术有限公司 Local resource access method and device
CN101634947A (en) * 2009-08-31 2010-01-27 腾讯科技(深圳)有限公司 IE control using local resources of client and application method thereof
CN102663318A (en) * 2012-03-22 2012-09-12 百度在线网络技术(北京)有限公司 Browser and client

Also Published As

Publication number Publication date
CN103927151A (en) 2014-07-16

Similar Documents

Publication Publication Date Title
CN103927151B (en) The method and apparatus that local operation is realized on web page
CN104091125B (en) Handle the method and suspended window processing unit of suspended window
Seo et al. FLEXDROID: Enforcing In-App Privilege Separation in Android.
US9876816B2 (en) Detecting stored cross-site scripting vulnerabilities in web applications
US20150089512A1 (en) Method and Device for Browsing Webpage
US20130111594A1 (en) Detection of dom-based cross-site scripting vulnerabilities
US20130031627A1 (en) Method and System for Preventing Phishing Attacks
JP2014203464A (en) Client based local malware detection method
CN111737692B (en) Application program risk detection method and device, equipment and storage medium
CN111580730B (en) Background display method of application program, electronic device and storage medium
CN107729452B (en) Webpage loading method and device, electronic equipment and computer readable storage medium
CN109597675B (en) Method and system for detecting malicious software behaviors of virtual machine
CN110389899B (en) Method and device for detecting API data type of JS program, medium and equipment
US9628939B2 (en) Data calling method and device
CN109325192B (en) Advertisement anti-shielding method and device
US10129278B2 (en) Detecting malware in content items
CN104572914B (en) The method and apparatus that Ad blocking is carried out in double-core browser
US10218767B2 (en) Method, system and browser for executing active object of browser
CN107944289A (en) A kind of embedded device of browser fingerprint detection method and detection browser fingerprint
JP2019525314A (en) Mitigation of malicious activity related to graphical user interface elements
US10902135B1 (en) Thwarting data leakage from a webpage
CN113760490B (en) Method and device for processing micro-service, electronic equipment and storage medium
CN106953730A (en) The safety method of the Windows code signatures containing timestamp is realized under physical isolation network environment
CN109189497A (en) A kind of method, apparatus and computer equipment for clean room software
CN108664253B (en) Application replacement method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant