WO2012142892A1 - 一种浏览器的脚本处理方法和系统 - Google Patents
一种浏览器的脚本处理方法和系统 Download PDFInfo
- Publication number
- WO2012142892A1 WO2012142892A1 PCT/CN2012/072452 CN2012072452W WO2012142892A1 WO 2012142892 A1 WO2012142892 A1 WO 2012142892A1 CN 2012072452 W CN2012072452 W CN 2012072452W WO 2012142892 A1 WO2012142892 A1 WO 2012142892A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- page
- proxy server
- client
- url
- code
- 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.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/14—Tree-structured documents
- G06F40/143—Markup, e.g. Standard Generalized Markup Language [SGML] or Document Type Definition [DTD]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9577—Optimising the visualization of content, e.g. distillation of HTML documents
Definitions
- the present invention relates to a terminal browser technology of the Internet, and in particular, to a script processing method and system for a browser. Background technique
- the browser on the PC compiles the JavaScript source code and converts the JavaScript source code into a binary bytecode used by the JavaScript virtual machine.
- the JavaScript virtual machine on the browser executes the corresponding binary bytecode.
- JavaScript is a common scripting language in current browsers.
- the main object of the present invention is to provide a script processing method and system for a browser to implement support for a script of a script (JavaScript) by a browser of a mobile terminal.
- JavaScript a script of a script
- the present invention provides a script processing method for a browser, the method comprising: receiving, by a proxy server, a uniform resource locator URL from a client;
- the proxy server requests a page from the Internet server corresponding to the URL, and compiles the script code of the page returned by the Internet server into a binary byte code and sends the script code to the client.
- the method further includes:
- the proxy server After requesting the page from the Internet server, the proxy server receives the hypertext markup language HTML file of the page returned by the Internet server, and converts the HTML file of the page into a binary document object model DOM tree structure and sends it to the office. Said client.
- the method further includes:
- the client renders the content of the DOM tree structure on a page.
- the script code is JavaScript code or VBScript code.
- the present invention also provides a script processing method for a browser, the method comprising: the client sending a uniform resource locator URL requested by the user to the proxy server; the client receiving the binary bytecode sent by the proxy server and executing; The binary bytecode is requested by the proxy server to the Internet server corresponding to the URL, and the script code of the page returned by the Internet server is compiled.
- the client After the client sends the URL to the proxy server, the client receives the DOM tree structure of the document object model sent by the proxy server, and renders the content of the DOM tree structure on the page; the DOM tree structure is
- the proxy server converts the hypertext markup language HTML file according to the page returned by the internet server.
- the present invention also provides a script processing system for a browser, the system comprising: a client, a proxy server, and an internet server, wherein
- the client is configured to send a URL requested by the user to the proxy server, and further Performing the binary bytecode returned by the proxy server;
- the proxy server is configured to request a page from an Internet server corresponding to the URL, and compile the script code of the page returned by the Internet server into a binary byte code, and send the file to the client;
- the Internet server is configured to provide a script code of the page to the proxy server according to the request of the proxy server.
- the Internet server is further configured to: after receiving the page request of the proxy server, send the HTML file of the page to the proxy server.
- the proxy server is further configured to convert the HTML file of the page into a binary DOM tree structure, and send the DOM tree structure to the client.
- the client is further configured to: after receiving the DOM tree structure of the proxy server, render content of the DOM tree structure on a page.
- the script code is JavaScript code or VBScript code.
- the present invention also provides a proxy server, including: a uniform resource locator, a URL receiving module, a page requesting module, and a compiling and sending module, where
- the URL receiving module is configured to receive a URL from a client, and notify the page requesting module;
- a page requesting module configured to request a page from an Internet server corresponding to the URL;
- the compiling and sending module is configured to compile a script code of a page returned by the Internet server into a binary byte code, and then send the code to the client.
- the compiling and sending module is further configured to: after the page requesting module requests a page from the internet server, the compiling and sending module receives a hypertext markup language HTML file of the page returned by the internet server, and the HTML of the page is The file is converted to a binary document object model DOM tree structure and sent to the client.
- the script code is JavaScript code or VBScript code.
- the present invention also provides a client, including: a uniform resource locator URL sending module and a receiving execution module, where
- the URL sending module is configured to send a URL requested by the user to the proxy server, where the receiving execution module is configured to receive and execute a binary bytecode sent by the proxy server;
- the proxy server requests a page from the Internet server corresponding to the URL, and compiles the script code of the page returned by the Internet server.
- the receiving execution module is further configured to: after the URL sending module sends the URL, the receiving execution module receives a DOM tree structure of the document object model sent by the proxy server, and renders the content of the DOM tree structure on the page.
- the DOM tree structure is converted by the proxy server according to a hypertext markup language HTML file of a page returned by the internet server.
- the script processing method and system of the browser separately treats the compiling and executing operations of the browser script code separately, that is, the browser script code is pre-compiled into a binary byte code on the proxy server, and then The browser client sent to the mobile terminal, the browser client of the mobile terminal directly executes the binary bytecode compiled by the proxy server.
- the overhead of executing the script code compilation by the mobile terminal browser is effectively saved, and the mobile terminal browser supports the execution of the script code (JavaScript).
- FIG. 1 is a flowchart of a script processing method of a browser according to the present invention.
- FIG. 2 is a schematic structural diagram of a script processing system of a browser according to the present invention.
- FIG. 3 is a schematic diagram of script processing of a browser in an embodiment of the present invention. detailed description
- the script processing method of the browser provided by the present invention, as shown in FIG. 1 , mainly includes the following steps:
- Step 101 The proxy server receives a uniform resource locator (URL, Universal Resource Locator ⁇ ) from the client.
- URL uniform resource locator
- the client sends the URL requested by the user to the proxy server.
- Step 102 The proxy server requests a page from the Internet server corresponding to the URL, and compiles the script code of the page returned by the Internet server into a binary byte code, and then sends the script code to the client.
- the proxy server After receiving the URL sent by the client, the proxy server finds the Internet server corresponding to the URL and sends a page request to the Internet server; after receiving the page request from the proxy server, the Internet server returns the script code of the corresponding page to Proxy server; The proxy server compiles the script code of the page returned by the internet server into a binary bytecode that can be used by the JavaScript virtual machine of the browser client, and sends the binary bytecode to the client.
- Step 103 The client executes the received binary bytecode.
- the client After receiving the binary bytecode returned by the proxy server, the client executes the corresponding binary bytecode through its JavaScript virtual machine.
- the Internet server after receiving the page request of the proxy server, the Internet server also needs to send the Hypertext Markup Language (HTML) file of the page to the proxy server; and then, the proxy server will HTML the page. Convert the file to a binary Document Object Model (DOM) tree structure and the DOM The tree structure is sent to the client; the client renders the content of the DOM tree structure on the page.
- the present invention further provides a browser script processing system, as shown in FIG. 2, comprising: a client 10, a proxy server 20, and an internet server 30.
- the client 10 is configured to send the URL requested by the user to the proxy server 20, and is also used to execute the binary bytecode returned by the proxy server 20.
- the proxy server 20 is configured to request a page from the Internet server 30 corresponding to the URL, and compile the script code of the page returned by the Internet server 30 into a binary byte code and send it to the client 10.
- the Internet server 30 is configured to provide the proxy code of the page to the proxy server 20 according to the request of the proxy server 20.
- the Internet server 30 is further configured to: after receiving the page request of the proxy server 20, send the HTML file of the page to the proxy server 20;
- the proxy server 20 is further configured to convert the HTML file of the page into a binary DOM tree structure, and send the DOM tree structure to the client 10;
- the client 10 is further configured to render the content of the DOM tree structure on the page after receiving the DOM tree structure of the proxy server 20.
- the proxy server 20 further includes: a URL receiving module 21, a page requesting module 22, and a compiling and transmitting module 23.
- the URL receiving module 21 is configured to receive a URL from the client, and notify the page requesting module 22; the page requesting module 22 is configured to request a page from the Internet server corresponding to the URL; and the compiling and sending module 23 is configured to return the page of the Internet server.
- the script code is compiled into binary bytecode and sent to the client.
- the compiling and sending module 23 is further configured to: after the page requesting module 22 requests the page from the internet server, the compiling and sending module 23 receives the HTML file of the page returned by the internet server, and converts the HTML file of the page into The binary DOM tree structure is sent to the client.
- the client 10 further includes: a URL sending module 11 and a receiving executing module 12.
- the URL sending module 11 is configured to send the URL requested by the user to the proxy server.
- Receive execution module 12, configured to receive and execute a binary bytecode sent by a proxy server; the binary bytecode is a script for requesting, by the proxy server, a page to an Internet server corresponding to the URL, and returning a page returned by the Internet server The code is compiled.
- the receiving execution module 12 is further configured to: after the URL sending module 11 sends the URL, the receiving execution module 12 receives the DOM tree structure sent by the proxy server, and renders the content of the DOM tree structure on the page; the DOM tree structure is The proxy server converts the HTML file based on the page returned by the Internet server.
- the user of the mobile terminal clicks on a World Wide Web (WWW) page link through the browser.
- WWW World Wide Web
- the browser client of the mobile terminal records the URL of the WWW page link, and The recorded URL is sent to the proxy server in the background; after receiving the URL sent by the client, the proxy server finds the WWW server corresponding to the URL, and sends a page request to the WWW server; the WWW server receives the page request from the proxy server.
- the HTML file and script code of the corresponding page are returned to the proxy server; the proxy server converts the HTML file of the page into a binary DOM tree structure, and compiles the script code of the page into a JavaScript virtual machine of the browser client.
- Binary bytecode and then sending the binary DOM tree structure and bytecode to the client; after receiving the binary DOM tree structure and bytecode returned by the proxy server, the client renders the DOM on the page The contents of the tree structure, and perform corresponding binary through its JavaScript virtual machine Bytecode.
- the WWW server sends the following HTML file to the proxy server:
- the data "54 51 42 4C 00 01 21 08 00 00 87 66 83 0D 0E 03" represents the file header
- the data in the upper dotted frame is the binary coded data of "hello, world!”
- the data in the lower dotted frame is The binary encoded data of the picture in the img tag.
- Position offset length ( Byte ) value meaning
- the client receives the binary data shown in Table 1, when rendering, according to the coordinate data and image size data provided in Table 2, the image is drawn at the appropriate position on the client's screen, and the rendering process is completed without itself. Calculate the coordinate position where the picture should be placed, which effectively reduces the computational burden on the client.
- the present invention separates the compiling and executing operations of the browser script code, that is, the browser script code is pre-compiled into a binary byte code on the proxy server and then sent to the browser client of the mobile terminal.
- the browser client of the mobile terminal directly executes the binary bytecode compiled by the proxy server.
- the script processing method and system of the browser of the present invention are not only applicable to the processing of JavaScript code, but also to the processing of VBScript code.
- the processing of the VBScript code is similar to the processing of the aforementioned JavaScript code, here No longer.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本发明公开了一种浏览器的脚本处理方法和系统,方法包括:客户端将用户请求的统一资源定位符(URL)发送到代理服务器;代理服务器向URL对应的互联网服务器请求页面,并将互联网服务器返回的页面的脚本代码编译成二进制字节码后发送到客户端;客户端执行二进制字节码。通过本发明,有效节省了移动终端浏览器执行脚本代码编译的开销,实现了移动终端浏览器对脚本代码执行操作的支持。
Description
一种浏览器的脚本处理方法和系统 技术领域
本发明涉及互联网的终端浏览器技术, 尤其涉及一种浏览器的脚本处 理方法和系统。 背景技术
目前, 在标准的个人计算机 ( PC, Personal Computer )浏览器上, 网 页中的 JavaScript代码执行时, 需要经过以下的步驟:
1、 PC上的浏览器对 JavaScript源代码进行编译, 将 JavaScript源代码 转换为 JavaScript虚拟机使用的二进制字节码;
2、 浏览器上的 JavaScript虚拟机执行相应的二进制字节码。
其中, JavaScript是目前浏览器中的常用脚本语言。
由于 PC 浏览器上的 JavaScript代码执行操作对中央处理器(CPU, Central Processing Unit )的处理能力、 内存空间大小的要求较高, 而现有的 移动终端 (如手机)无论是在 CPU的处理能力, 还是在内存空间大小上都 严重受限, 因此大部分移动终端都无法达到上述 PC浏览器上的 JavaScript 代码执行操作的要求, 从而, 将上述 PC浏览器上的 JavaScript代码执行操 作应用于移动终端中非常困难。 现有技术还无法提供上述技术问题的解决 方案, 从而给实际应用带来了不便。 发明内容
有鉴于此, 本发明的主要目的在于提供一种浏览器的脚本处理方法和 系统, 以实现移动终端的浏览器对脚本代码(JavaScript )执行操作的支持。
为达到上述目的, 本发明的技术方案是这样实现的:
本发明提供了一种浏览器的脚本处理方法, 该方法包括: 代理服务器接收来自客户端的统一资源定位符 URL;
所述代理服务器向所述 URL对应的互联网服务器请求页面, 并将所 述互联网服务器返回的页面的脚本代码编译成二进制字节码后发送到所 述客户端。
该方法进一步包括:
所述代理服务器在向互联网服务器请求页面后, 接收所述互联网服 务器返回的页面的超文本标记语言 HTML文件, 并将所述页面的 HTML 文件转换为二进制的文档对象模型 DOM树结构后发送到所述客户端。
在所述代理服务器将 DOM树结构发送到客户端后 ,该方法进一步包 括:
所述客户端在页面上渲染所述 DOM树结构的内容。
所述脚本代码为 JavaScript代码或 VBScript代码。
本发明还提供了一种浏览器的脚本处理方法, 该方法包括: 客户端将用户请求的统一资源定位符 URL发送到代理服务器; 客户端接收所述代理服务器发送的二进制字节码并执行; 所述二进 制字节码是由所述代理服务器向所述 URL对应的互联网服务器请求页 面, 并将所述互联网服务器返回的页面的脚本代码编译得到。
在客户端将 URL发送到代理服务器后, 所述客户端接收所述代理服 务器发送的文档对象模型 DOM树结构,并在页面上渲染所述 DOM树结 构的内容;所述 DOM树结构是由所述代理服务器根据所述互联网服务器 返回的页面的超文本标记语言 HTML文件转换得到。
本发明还提供了一种浏览器的脚本处理系统, 该系统包括: 客户端、 代理服务器和互联网服务器, 其中,
所述客户端, 用于将用户请求的 URL发送到所述代理服务器, 还用
于执行所述代理服务器返回的二进制字节码;
所述代理服务器, 用于向所述 URL对应的互联网服务器请求页面, 并将所述互联网服务器返回的页面的脚本代码编译成二进制字节码后发 送到所述客户端;
所述互联网服务器, 用于根据所述代理服务器的请求, 向所述代理 服务器提供页面的脚本代码。
所述互联网服务器进一步用于, 在接收到代理服务器的页面请求后, 将页面的 HTML文件发送到所述代理服务器。
所述代理服务器进一步用于, 将所述页面的 HTML文件转换为二进 制的 DOM树结构, 并将所述 DOM树结构发送到所述客户端。
所述客户端进一步用于, 在接收到所述代理服务器的 DOM树结构 后, 在页面上渲染所述 DOM树结构的内容。
所述脚本代码为 JavaScript代码或 VBScript代码。
本发明还提供了一种代理服务器, 包括: 统一资源定位符 URL接收 模块、 页面请求模块和编译发送模块, 其中,
所述 URL接收模块, 用于接收来自客户端的 URL, 并通知所述页面 请求模块;
页面请求模块, 用于向所述 URL对应的互联网服务器请求页面; 所述编译发送模块, 用于将所述互联网服务器返回的页面的脚本代 码编译成二进制字节码后发送到所述客户端。
所述编译发送模块进一步用于, 在所述页面请求模块向互联网服务 器请求页面后, 所述编译发送模块接收所述互联网服务器返回的页面的 超文本标记语言 HTML文件,并将所述页面的 HTML文件转换为二进制 的文档对象模型 DOM树结构后发送到所述客户端。
所述脚本代码为 JavaScript代码或 VBScript代码。
本发明还提供了一种客户端, 包括: 统一资源定位符 URL发送模块 和接收执行模块, 其中,
所述 URL发送模块, 用于将用户请求的 URL发送到代理服务器; 所述接收执行模块, 用于接收所述代理服务器发送的二进制字节码 并执行; 所述二进制字节码是由所述代理服务器向所述 URL对应的互联 网服务器请求页面, 并将所述互联网服务器返回的页面的脚本代码编译 得到。
所述接收执行模块进一步用于, 在所述 URL发送模块发送 URL之后, 所述接收执行模块接收所述代理服务器发送的文档对象模型 DOM树结构, 并在页面上渲染所述 DOM树结构的内容;所述 DOM树结构是由所述代理 服务器根据所述互联网服务器返回的页面的超文本标记语言 HTML文件转 换得到。
本发明所提供的一种浏览器的脚本处理方法和系统, 将对浏览器脚本 代码的编译和执行操作分开处理, 即在代理服务器上将浏览器脚本代码预 先编译成二进制字节码后再下发给移动终端的浏览器客户端, 移动终端的 浏览器客户端直接执行代理服务器编译后的二进制字节码即可。 通过本发 明, 有效节省了移动终端浏览器执行脚本代码编译的开销, 实现了移动终 端浏览器对脚本代码 ( JavaScript )执行操作的支持。 附图说明
图 1为本发明一种浏览器的脚本处理方法的流程图;
图 2为本发明一种浏览器的脚本处理系统的结构示意图;
图 3为本发明实施例中浏览器的脚本处理示意图。 具体实施方式
下面结合附图和具体实施例对本发明的技术方案进一步详细阐述。
为实现移动终端的浏览器对脚本代码(JavaScript )执行操作的支持, 本发明所提供的一种浏览器的脚本处理方法, 如图 1 所示, 主要包括以下 步驟:
步驟 101 , 代理服务器接收来自客户端的统一资源定位符 (URL , Universal Resource Locator λ
客户端将用户请求的 URL发送到代理服务器。
用户在需要访问网站时, 会在其所使用的移动终端的浏览器的客户端 上点击或输入所需访问网站的地址、 即 URL, 此时, 移动终端的浏览器的 客户端会记录用户所点击或输入的 URL,并将记录的 URL发送到代理服务 哭
步驟 102, 代理服务器向 URL对应的互联网服务器请求页面, 并将互 联网服务器返回的页面的脚本代码编译成二进制字节码后发送到客户端。
代理服务器接收到客户端发送的 URL后, 找到与该 URL对应的互联 网服务器, 并向该互联网服务器发送页面请求; 互联网服务器接收到来自 代理服务器的页面请求后, 会将对应页面的脚本代码返回给代理服务器; 代理服务器将互联网服务器返回的页面的脚本代码编译成浏览器客户端的 JavaScript虚拟机能够使用的二进制字节码, 并将所述二进制字节码发送到 客户端。
步驟 103 , 客户端执行所接收的二进制字节码。
客户端接收到代理服务器返回的二进制字节码后, 通过其 JavaScript 虚拟机执行相应的二进制字节码。
需要说明的是, 互联网服务器在接收到代理服务器的页面请求后, 还 需要将页面的超文本标记语言 (HTML, Hyper Text Mark-up Language )文 件发送到代理服务器; 进而, 代理服务器将页面的 HTML文件转换为二进 制的文档对象模型( DOM, Document Object Model )树结构,并将所述 DOM
树结构发送到客户端; 客户端在页面上渲染所述 DOM树结构的内容。 对应上述浏览器的脚本处理方法, 本发明还提供了一种浏览器的脚本 处理系统, 如图 2所示, 包括: 客户端 10、 代理服务器 20和互联网服务器 30。 其中, 客户端 10, 用于将用户请求的 URL发送到代理服务器 20, 还 用于执行代理服务器 20返回的二进制字节码。代理服务器 20,用于向 URL 对应的互联网服务器 30请求页面, 并将互联网服务器 30返回的页面的脚 本代码编译成二进制字节码后发送到客户端 10。 互联网服务器 30, 用于根 据代理服务器 20的请求, 向代理服务器 20提供页面的脚本代码。
较佳的, 互联网服务器 30还可用于, 在接收到代理服务器 20的页面 请求后, 将页面的 HTML文件发送到代理服务器 20;
相应的,代理服务器 20进一步用于,将该页面的 HTML文件转换为二 进制的 DOM树结构, 并将 DOM树结构发送到客户端 10;
客户端 10进一步用于,在接收到代理服务器 20的 DOM树结构后,在 页面上渲染该 DOM树结构的内容。
其中, 代理服务器 20还包括: URL接收模块 21、 页面请求模块 22和 编译发送模块 23。 URL接收模块 21 , 用于接收来自客户端的 URL, 并通 知页面请求模块 22; 页面请求模块 22, 用于向 URL对应的互联网服务器 请求页面; 编译发送模块 23 , 用于将互联网服务器返回的页面的脚本代码 编译成二进制字节码后发送到客户端。
较佳的, 编译发送模块 23还可进一步用于, 在页面请求模块 22向互 联网服务器请求页面后, 编译发送模块 23接收互联网服务器返回的页面的 HTML文件 , 并将所述页面的 HTML文件转换为二进制的 DOM树结构后 发送到客户端。
客户端 10还包括: URL发送模块 11和接收执行模块 12。 其中, URL 发送模块 11 , 用于将用户请求的 URL发送到代理服务器。 接收执行模块
12, 用于接收代理服务器发送的二进制字节码并执行; 所述二进制字节码 是由所述代理服务器向所述 URL对应的互联网服务器请求页面, 并将所述 互联网服务器返回的页面的脚本代码编译得到。
接收执行模块 12进一步用于, 在 URL发送模块 11发送 URL之后, 接收执行模块 12接收代理服务器发送的 DOM树结构, 并在页面上渲染所 述 DOM树结构的内容;所述 DOM树结构是由代理服务器根据互联网服务 器返回的页面的 HTML文件转换得到。
下面再结合图 3 所示的实施例对本发明的浏览器的脚本处理方法和系 统进一步详细说明。
如图 3所示, 移动终端的用户通过浏览器点击了一个万维网 (WWW, World Wide Web ) 页面链接, 此时, 该移动终端的浏览器客户端记录下该 WWW页面链接的 URL, 并将所记录的 URL发送到后台的代理服务器; 代 理服务器接收到客户端发来的 URL后, 找到与该 URL对应的 WWW服务 器, 并向该 WWW服务器发送页面请求; WWW服务器接收到来自代理服 务器的页面请求后, 会将对应页面的 HTML文件和脚本代码返回给代理服 务器; 代理服务器将页面的 HTML文件转换为二进制的 DOM树结构, 并 将页面的脚本代码编译成浏览器客户端的 JavaScript虚拟机能够使用的二 进制字节码, 然后将所述二进制的 DOM树结构和字节码下发给客户端;客 户端接收到代理服务器返回的二进制的 DOM树结构和字节码后,在页面上 渲染所述 DOM树结构的内容, 并通过其 JavaScript虚拟机执行相应的二进 制字节码。
例如, WWW服务器发送给代理服务器以下的 HTML文件:
<html>
<body>
hello, world!
</br>
<img src="./4.jpg" width:" 130" height- Ί30">
</body>
</html>
编码成二进制的 DOM树结构, 如下表 1所示:
00000000 54 51 42 4C 00 01 21 08 00 00 87 66 83 OD OE 03
00000010 Ιθ3 19 08 08 4C 13 07 FF 00 00 00 0C 0E 9B 0C 68i
I ———二:—:.二―二 ;
00000020 |65 6C 6C 6F 2C 77 6F 72 6C 64 21 ]-24 OF 08 1C 81 ·
00000030 j_02 81 _02 94—07— 2E _2F 3_4 _2E 6A_70 67 j 表 1
其中, 数据 "54 51 42 4C 00 01 21 08 00 00 87 66 83 0D 0E 03" 表示文 件头, 上边虚线框内的数据为 "hello,world!" 的二进制编码数据, 下边虚 线框内的数据为 img标签中的图片的二进制编码数据。
以 img标签中的图片为例, 具体含义说明如下表 2所示:
位置偏 长度( Byte ) 取值 含义
移
00 1 0x24 tagID表示这是一张图片 img标签
01 1 0x0f 本 tag包含的数据的长度
02 1 0x08 图片显示时的横坐标
03 1 0x1c 图片显示时的纵坐标
04 2 0x81 0x02 图片显示时的宽度
06 2 0x81 0x02 图片显示时的高度
08 1 0x94 图片文件名 ID
09 1 0x07 图片文件名的字符串长 度
10 7 0x2e 0x2f 0x34 图片文件名字符串
0x2e 0x6a 0x70
0x67
表 2
客户端收到表 1所示的二进制数据后, 进行渲染时, 就根据上表 2提 供的坐标数据和图片大小数据, 将图片绘制在客户端的屏幕的合适位置, 完成渲染过程, 而不需要自己计算图片应该放置的坐标位置, 这有效的减 轻了客户端的计算负担。
综上所述, 本发明将对浏览器脚本代码的编译和执行操作分开处理, 即在代理服务器上将浏览器脚本代码预先编译成二进制字节码后再下发给 移动终端的浏览器客户端, 移动终端的浏览器客户端直接执行代理服务器 编译后的二进制字节码即可。 通过这样的处理, 能够有效节省移动终端浏 览器执行脚本代码编译的开销, 实现移动终端浏览器对脚本代码 ( JavaScript )执行操作的支持。 还需说明的是, 本发明浏览器的脚本处理 方法和系统不仅适用于对 JavaScript代码的处理, 也适用于对 VBScript代 码的处理, 针对 VBScript代码的处理与前述对 JavaScript代码的处理类似, 此处不再赘述。
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围。
Claims
1、 一种浏览器的脚本处理方法, 其特征在于, 该方法包括: 代理服务器接收来自客户端的统一资源定位符 URL;
所述代理服务器向所述 URL对应的互联网服务器请求页面, 并将所 述互联网服务器返回的页面的脚本代码编译成二进制字节码后发送到所 述客户端。
2、 根据权利要求 1所述浏览器的脚本处理方法, 其特征在于, 该方 法进一步包括:
所述代理服务器在向互联网服务器请求页面后, 接收所述互联网服 务器返回的页面的超文本标记语言 HTML文件, 并将所述页面的 HTML 文件转换为二进制的文档对象模型 DOM树结构后发送到所述客户端。
3、 根据权利要求 2所述浏览器的脚本处理方法, 其特征在于, 在所 述代理服务器将 DOM树结构发送到客户端后, 该方法进一步包括:
所述客户端在页面上渲染所述 DOM树结构的内容。
4、 根据权利要求 1、 2或 3所述浏览器的脚本处理方法, 其特征在 于, 所述脚本代码为 JavaScript代码或 VBScript代码。
5、 一种浏览器的脚本处理方法, 其特征在于, 该方法包括: 客户端将用户请求的统一资源定位符 URL发送到代理服务器; 客户端接收所述代理服务器发送的二进制字节码并执行; 所述二进 制字节码是由所述代理服务器向所述 URL对应的互联网服务器请求页 面, 并将所述互联网服务器返回的页面的脚本代码编译得到。
6、 根据权利要求 5所述浏览器的脚本处理方法, 其特征在于, 在客 户端将 URL发送到代理服务器后, 所述客户端接收所述代理服务器发送 的文档对象模型 DOM树结构,并在页面上渲染所述 DOM树结构的内容; 所述 DOM树结构是由所述代理服务器根据所述互联网服务器返回的页 面的超文本标记语言 HTML文件转换得到。
7、一种浏览器的脚本处理系统, 其特征在于, 该系统包括: 客户端、 代理服务器和互联网服务器, 其中,
所述客户端, 用于将用户请求的 URL发送到所述代理服务器, 还用 于执行所述代理服务器返回的二进制字节码;
所述代理服务器, 用于向所述 URL对应的互联网服务器请求页面, 并将所述互联网服务器返回的页面的脚本代码编译成二进制字节码后发 送到所述客户端;
所述互联网服务器, 用于根据所述代理服务器的请求, 向所述代理 服务器提供页面的脚本代码。
8、 根据权利要求 7所述浏览器的脚本处理系统, 其特征在于, 所述 互联网服务器进一步用于, 在接收到代理服务器的页面请求后, 将页面 的 HTML文件发送到所述代理服务器。
9、 根据权利要求 7所述浏览器的脚本处理系统, 其特征在于, 所述 代理服务器进一步用于,将所述页面的 HTML文件转换为二进制的 DOM 树结构, 并将所述 DOM树结构发送到所述客户端。
10、 根据权利要求 9 所述浏览器的脚本处理系统, 其特征在于, 所 述客户端进一步用于,在接收到所述代理服务器的 DOM树结构后,在页 面上渲染所述 DOM树结构的内容。
11、 根据权利要求 7至 10任一项所述浏览器的脚本处理系统, 其特 征在于, 所述脚本代码为 JavaScript代码或 VBScript代码。
12、 一种代理服务器, 其特征在于, 包括: 统一资源定位符 URL接 收模块、 页面请求模块和编译发送模块, 其中,
所述 URL接收模块, 用于接收来自客户端的 URL, 并通知所述页面 请求模块; 页面请求模块, 用于向所述 URL对应的互联网服务器请求页面; 所述编译发送模块, 用于将所述互联网服务器返回的页面的脚本代 码编译成二进制字节码后发送到所述客户端。
13、 根据权利要求 12所述代理服务器, 其特征在于, 所述编译发送 模块进一步用于, 在所述页面请求模块向互联网服务器请求页面后, 所 述编译发送模块接收所述互联网服务器返回的页面的超文本标记语言 HTML文件, 并将所述页面的 HTML文件转换为二进制的文档对象模型 DOM树结构后发送到所述客户端。
14、 根据权利要求 12或 13所述代理服务器, 其特征在于, 所述脚 本代码为 JavaScript代码或 VBScript代码。
15、 一种客户端, 其特征在于, 包括: 统一资源定位符 URL发送模 块和接收执行模块, 其中,
所述 URL发送模块, 用于将用户请求的 URL发送到代理服务器; 所述接收执行模块, 用于接收所述代理服务器发送的二进制字节码 并执行; 所述二进制字节码是由所述代理服务器向所述 URL对应的互联 网服务器请求页面, 并将所述互联网服务器返回的页面的脚本代码编译 得到。
16、 根据权利要求 15所述客户端, 其特征在于, 所述接收执行模块 进一步用于, 在所述 URL发送模块发送 URL之后, 所述接收执行模块 接收所述代理服务器发送的文档对象模型 DOM树结构,并在页面上渲染 所述 DOM树结构的内容;所述 DOM树结构是由所述代理服务器根据所 述互联网服务器返回的页面的超文本标记语言 HTML文件转换得到。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US14/051,230 US20140068417A1 (en) | 2011-04-19 | 2013-10-10 | Script Processing Method and System for Browsers |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110097899.X | 2011-04-19 | ||
| CN201110097899.XA CN102750281B (zh) | 2011-04-19 | 2011-04-19 | 一种浏览器的脚本处理方法和系统 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US14/051,230 Continuation US20140068417A1 (en) | 2011-04-19 | 2013-10-10 | Script Processing Method and System for Browsers |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2012142892A1 true WO2012142892A1 (zh) | 2012-10-26 |
Family
ID=47030473
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2012/072452 Ceased WO2012142892A1 (zh) | 2011-04-19 | 2012-03-16 | 一种浏览器的脚本处理方法和系统 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US20140068417A1 (zh) |
| CN (1) | CN102750281B (zh) |
| WO (1) | WO2012142892A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111176625A (zh) * | 2019-12-31 | 2020-05-19 | 杭州趣链科技有限公司 | 一种在浏览器端高效编译Solidity智能合约的方法 |
Families Citing this family (17)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9137210B1 (en) * | 2012-02-21 | 2015-09-15 | Amazon Technologies, Inc. | Remote browsing session management |
| CN102955854B (zh) * | 2012-11-06 | 2015-11-25 | 搜游网络科技(北京)有限公司 | 一种基于html5协议的网页展现方法及装置 |
| CN103226475B (zh) * | 2013-05-16 | 2016-03-16 | 百度在线网络技术(北京)有限公司 | 转码时实现控件替换的方法及装置 |
| CN103513987A (zh) * | 2013-09-18 | 2014-01-15 | 小米科技有限责任公司 | 一种浏览器网页的渲染处理方法、装置及终端设备 |
| CN103544276B (zh) * | 2013-10-22 | 2017-05-10 | 北京京东尚科信息技术有限公司 | 一种采用虚拟机显示脚本文件的方法及装置 |
| CN104182700A (zh) * | 2013-12-12 | 2014-12-03 | 南宁市磁汇科技有限公司 | 保护web页面可执行脚本的方法 |
| CN105577710B (zh) * | 2014-10-09 | 2019-06-11 | 阿里巴巴集团控股有限公司 | 提供服务和获取服务的方法、装置和系统 |
| CN106775900B (zh) * | 2017-01-20 | 2020-10-09 | 陈刚 | 应用浏览器的调用方法和系统 |
| CN106951270B (zh) * | 2017-04-06 | 2023-04-07 | 腾讯科技(深圳)有限公司 | 一种代码处理方法、系统及服务器 |
| CN108108440A (zh) * | 2017-12-21 | 2018-06-01 | 北京慧数科技有限公司 | 代理服务器及互联网数据的采集方法 |
| CN108334379A (zh) * | 2018-01-05 | 2018-07-27 | 北京明略软件系统有限公司 | 一种页面扩展功能的实现方法及实现装置 |
| CN108459852A (zh) * | 2018-01-30 | 2018-08-28 | 美通云动(北京)科技有限公司 | 脚本处理方法及装置、存储介质、电子设备 |
| CN110647330B (zh) * | 2019-09-10 | 2023-04-07 | 北京网聘咨询有限公司 | 针对Web的即时编译方法及工具 |
| CN112954075B (zh) * | 2021-03-29 | 2023-04-07 | 中信银行股份有限公司 | 一种业务功能实现方法、系统、对应装置及存储介质 |
| CN118349757A (zh) * | 2021-08-25 | 2024-07-16 | 北京达佳互联信息技术有限公司 | 页面展示方法、装置、电子设备及存储介质 |
| CN114065088A (zh) * | 2021-10-27 | 2022-02-18 | 深圳Tcl新技术有限公司 | 网页解析方法、系统、设备及计算机可读存储介质 |
| CN114329149B (zh) * | 2021-12-02 | 2025-08-29 | 瑞数信息技术(上海)有限公司 | 页面信息自动抓取的检测方法、装置、电子设备及可读存储介质 |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101383848A (zh) * | 2007-09-04 | 2009-03-11 | Lg电信株式会社 | 用于移动网络服务的系统和方法 |
| CN101860533A (zh) * | 2010-05-26 | 2010-10-13 | 卓望数码技术(深圳)有限公司 | 一种基于c/s架构浏览器的数据传输方法及服务器 |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN100343802C (zh) * | 2004-05-10 | 2007-10-17 | 华为技术有限公司 | 统一用户界面的方法及系统 |
| US20090063530A1 (en) * | 2007-09-04 | 2009-03-05 | Lg Telecom Ltd. | System and method for mobile web service |
| US20100050089A1 (en) * | 2008-08-20 | 2010-02-25 | Company 100, Inc. | Web browser system of mobile communication terminal, using proxy server |
| CN101448005B (zh) * | 2008-12-24 | 2012-05-02 | 深圳市深信服电子科技有限公司 | 一种在网关进行数据安全检测方法、系统及设备 |
-
2011
- 2011-04-19 CN CN201110097899.XA patent/CN102750281B/zh active Active
-
2012
- 2012-03-16 WO PCT/CN2012/072452 patent/WO2012142892A1/zh not_active Ceased
-
2013
- 2013-10-10 US US14/051,230 patent/US20140068417A1/en not_active Abandoned
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101383848A (zh) * | 2007-09-04 | 2009-03-11 | Lg电信株式会社 | 用于移动网络服务的系统和方法 |
| CN101860533A (zh) * | 2010-05-26 | 2010-10-13 | 卓望数码技术(深圳)有限公司 | 一种基于c/s架构浏览器的数据传输方法及服务器 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111176625A (zh) * | 2019-12-31 | 2020-05-19 | 杭州趣链科技有限公司 | 一种在浏览器端高效编译Solidity智能合约的方法 |
| CN111176625B (zh) * | 2019-12-31 | 2023-07-28 | 杭州趣链科技有限公司 | 一种在浏览器端高效编译Solidity智能合约的方法 |
Also Published As
| Publication number | Publication date |
|---|---|
| US20140068417A1 (en) | 2014-03-06 |
| CN102750281B (zh) | 2015-09-16 |
| CN102750281A (zh) | 2012-10-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2012142892A1 (zh) | 一种浏览器的脚本处理方法和系统 | |
| US9460222B2 (en) | System for rewriting dynamically generated uniform resource locators in proxied hyper text markup language content in accordance with proxy server rules | |
| CN100481088C (zh) | 网页资源发布方法和发布系统 | |
| CN103392179B (zh) | 获取页面资源的方法及装置、浏览器及移动终端 | |
| US20150189036A1 (en) | Offline caching method and apparatus | |
| TWI451335B (zh) | WebKit瀏覽器裝置與應用於其上之網頁內容載入方法 | |
| WO2012100701A1 (zh) | 一种获取图文信息的装置、系统及方法 | |
| CN103281387B (zh) | 处理网页中子资源的方法、服务器、客户端和系统 | |
| CN103873918B (zh) | 图片处理方法、装置及终端 | |
| CN108416021B (zh) | 一种浏览器网页内容处理方法、装置、电子设备及可读介质 | |
| WO2015043383A1 (zh) | 一种进行网页加载的方法、装置和浏览器 | |
| CN103581232B (zh) | web页面传输方法、web页面显示装置及包含该装置的系统 | |
| WO2018001124A1 (zh) | 网页文件发送方法、网页渲染方法及装置、网页渲染系统 | |
| CN103338236B (zh) | 一种并发数据获取方法及系统 | |
| WO2012155678A1 (zh) | 基于浏览器解析方式的手机应用界面的开发方法和终端 | |
| CN108595468A (zh) | 一种网页数据的获取方法、装置、服务器、终端和系统 | |
| CN103530329A (zh) | 一种进行网页加载的方法、装置和浏览器 | |
| CN102214224A (zh) | 一种访问网络资源的优化方法、网页浏览器和终端 | |
| CN111506844A (zh) | 页面处理方法、设备及计算机存储介质 | |
| CN102368250B (zh) | 一种ie内核浏览器的页面下载控制方法和系统 | |
| CN105808727A (zh) | 基于html5的网站跨屏适配技术架构和适配方法 | |
| JP2009163326A (ja) | マークアップ言語文書変換装置、マークアップ言語文書変換方法、マークアップ言語文書変換プログラム、およびマークアップ言語文書変換システム | |
| JP5774429B2 (ja) | 通信装置および通信方法、ならびに、プログラム | |
| JP2004013297A (ja) | Web画像の表示制御方法、Web画像表示制御装置 | |
| CN103618791A (zh) | 一种支持xslt文件的web反向代理方法、装置和系统 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 12774457 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 14/03/2014) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 12774457 Country of ref document: EP Kind code of ref document: A1 |