[go: up one dir, main page]

WO2012171391A1 - Network resource access optimization method, web browser, and terminal - Google Patents

Network resource access optimization method, web browser, and terminal Download PDF

Info

Publication number
WO2012171391A1
WO2012171391A1 PCT/CN2012/073216 CN2012073216W WO2012171391A1 WO 2012171391 A1 WO2012171391 A1 WO 2012171391A1 CN 2012073216 W CN2012073216 W CN 2012073216W WO 2012171391 A1 WO2012171391 A1 WO 2012171391A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
path
outer chain
request
web browser
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
Application number
PCT/CN2012/073216
Other languages
French (fr)
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Publication of WO2012171391A1 publication Critical patent/WO2012171391A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]

Definitions

  • the present invention relates to the field of software applications, and in particular, to an optimization method for accessing network resources, a web browser and a terminal. Background technique
  • HTML pages based on Hyper Text Mark-up Language (HTML) encoded files.
  • HTML pages a large number of external links are used, such as: script files (such as JavaScript). File), Cascading Style Sheet (CSS) files, image files (such as bitmap images (BMP) files, Joint Photographic Experts Group (JPEG) files, image interchange formats (Graphics Interchange) Format, GIF) files, Portable Network Graphic Format (PNG) files, and more.
  • script files such as JavaScript). File
  • Cascading Style Sheet (CSS) files image files (such as bitmap images (BMP) files, Joint Photographic Experts Group (JPEG) files, image interchange formats (Graphics Interchange) Format, GIF) files, Portable Network Graphic Format (PNG) files, and more.
  • BMP bitmap images
  • JPEG Joint Photographic Experts Group
  • GIF Portable Network Graphic Format
  • PNG Portable Network Graphic Format
  • Path 1 htt ://127.0.0.1 /home/webserver/, ./test.jpg;
  • Path 2 htt ://127.0.0.1 /home/httpserver/../test.jpg;
  • path 2 is actually pointing to the test.jpg file in the server home directory, for the terminal, the absolute path of the file is:
  • the technical problem to be solved by the embodiments of the present invention is to provide an optimization method for accessing network resources.
  • the web browser and the terminal are used to avoid multiple requests for access to the service server for the external link files with different paths, thereby saving the network resources and the resources of the device itself.
  • an embodiment of the present invention provides an optimization method for accessing network resources, including:
  • the foregoing method further has the following features: after the request for the access to the external link file is initiated, the method further includes:
  • the file data corresponding to the outer chain file is downloaded, and the correspondence between the absolute path and the downloaded file data is saved.
  • the step of parsing the absolute path of the outer chain file in the service server from the path URL in the page of the outer chain file includes:
  • the above method also has the following features:
  • the outer chain file includes one or more of a script file, a cascading style sheet file, and an image file.
  • the present invention further provides a web browser, including:
  • a parsing module configured to: after receiving the request for accessing the outer chain file, parsing the absolute path of the outer chain file in the service server from the path uniform resource locator (URL) of the outer chain file in the page ; as well as
  • the access processing module is configured to: detect whether the file data corresponding to the absolute path is cached, and if yes, cancel the request for accessing the outer chain file; if not, initiate the request for accessing the outer chain file.
  • the above web browser also has the following features:
  • a downloading module configured to: after the access processing module initiates the request for accessing the outer chain file, download the file data corresponding to the outer chain file.
  • the above web browser also has the following features:
  • a cache module configured to: save a correspondence between the absolute path and file data downloaded by the download module.
  • the above web browser also has the following features:
  • the parsing module is configured to: after receiving the request for accessing the outer chain file, determine whether the path URL includes a file path symbol, and if not, use the path URL as an absolute of the outer chain file in the service server. a path; if yes, performing a simplified process according to the meaning of the file path symbol to obtain an absolute path of the outer chain file in the service server.
  • the above web browser also has the following features:
  • the outer chain file includes one or more of a script file, a cascading style sheet file, and an image file.
  • the present invention also provides a terminal, including the above web browser.
  • the embodiments of the present invention provide an optimization method for accessing network resources, a web browser, and a terminal, which can correctly access external file files, and can implement an external file path screening process, and the same external chain file has different paths. You can avoid requesting access to the service server multiple times, so as to save network resources and resources of the device itself.
  • FIG. 1 is a schematic diagram of a web browser according to an embodiment of the present invention
  • FIG. 3 is a flowchart of an optimization method for accessing network resources according to an embodiment of the present invention. Preferred embodiment of the invention
  • FIG. 1 is a schematic diagram of a web browser according to an embodiment of the present invention. As shown in FIG. 1, the web browser of this embodiment includes:
  • the parsing module is configured to parse the absolute path of the outer chain file in the service server from the path URL in the page of the outer chain file after receiving the request for accessing the outer chain file;
  • the access processing module is configured to detect whether the file data corresponding to the absolute path is cached, and if yes, cancel the request for accessing the outer chain file; if not, initiate the request for accessing the outer chain file.
  • the parsing module is configured to: after receiving the request for accessing the outer chain file, determine whether the path URL includes a file path symbol, and if not, use the path URL as the outer chain file in the service server. Absolute path; if yes, the simplified process is performed according to the meaning of the file path symbol to obtain an absolute path of the outer chain file in the service server.
  • the web browser may further include:
  • the downloading module is configured to download the file data corresponding to the outer chain file after the access processing module initiates the request for accessing the outer chain file.
  • the cache module is configured to save a correspondence between the absolute path and the file data downloaded by the download module.
  • the outer chain file includes one or more of a script file, a cascading style sheet file, and an image file.
  • the invention also provides a terminal comprising the above web browser.
  • FIG. 2 is a flowchart of an optimization method for accessing network resources according to an embodiment of the present invention. As shown in FIG. 2, the method includes the following steps:
  • the absolute path of the outer chain file in the service server is parsed in the URL
  • the method in this embodiment can avoid the problem of wasting resources by initiating multiple requests to the service server for the external link file with multipath in the web page.
  • the embodiment of the present invention recalculates the path URL of the web browser for parsing the outer chain file in the page, for example, simplifying calculation of path symbols such as "../”, “./”, “//” in the path URL, and calculating The result is an absolute path that does not contain external links such as "../”, “./”, “//”, etc., so that the web browser can detect the data related to the external link file.
  • the file caching function is introduced on the terminal side of the web browser, and the data of the external chain file that has been accessed is saved, and the mapping relationship between the outer chain file data and the absolute path of the outer chain file is also saved.
  • FIG. 3 is a flowchart of an optimization method for accessing network resources according to an embodiment of the present invention. As shown in FIG. 3, the method includes the following steps:
  • Step 301 The web browser receives a request for accessing an external link file.
  • Step 302 The web browser parses the web page, and parses the absolute path from the path URL specified by the outer chain file in the page;
  • the web browser parses the path URL defined by the outer chain file in the page, it is determined whether the path URL has a file path symbol, such as "../” "./” "//”, etc., if none of the above If the path symbol does not need to be simplified, the path URL is directly returned. If the path contains the path symbol, the path is simplified according to the meaning of the symbol.
  • the processed path URL is the absolute path of the external link file in the service server. .
  • Step 303 the web browser detects whether the file data corresponding to the absolute path has been cached, if the cache has passed, then proceeds to step 304; if there is no cache, then proceeds to step 305;
  • Step 304 directly use the cached related file data
  • Step 305 Download related file data, cache the file data after the download is completed, and save the correspondence between the absolute path of the file and the file data for subsequent query.
  • the embodiments of the present invention provide an optimization method for accessing network resources, a web browser, and a terminal, which can correctly access external file files, and can implement an external file path screening process, and the same external chain file can be avoided even if different paths are used.
  • the service server requests access multiple times, thereby saving network resources and resources of the device itself.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A network resource access optimization method, a Web browser, and a terminal. The method comprises: after receiving a request for accessing a linked file, parsing a path uniform resource locator (URL) of the linked file in a page to obtain an absolute path of the linked file in a service server; detecting whether file data corresponding to the absolute path is buffered; if yes, canceling the request for accessing the linked file; and if no, initiating the request for accessing the linked file. The present invention not only can correctly access a linked file but also can discriminatively process linked files, that is, for the same linked file, even if the paths are different, multiple requests for accessing the file server can be avoided, thereby achieving the purpose of saving network resources and apparatus resources.

Description

一种访问网络资源的优化方法、 网页浏览器和终端  Optimization method for accessing network resources, web browser and terminal

技术领域 Technical field

本发明涉及软件应用领域, 尤其涉及一种访问网络资源的优化方法、 网 页 (Web )浏览器和终端。 背景技术  The present invention relates to the field of software applications, and in particular, to an optimization method for accessing network resources, a web browser and a terminal. Background technique

互联网发展迅速, 其主要载体是以超文本标记语言( Hyper Text Mark-up Language, HTML )编码文件为基础的 HTML网页, 而在 HTML网页使用了 大量的外链文件, 例如: 脚本文件 (例如 JavaScript文件) 、 层叠样式表 ( Cascading Style Sheet, CSS )文件、图像文件(例如位图图片(bitmap, BMP ) 文件、 联合图像专家组(Joint Photographic Experts Group, JPEG )文件、 图 像互换格式 (Graphics Interchange Format, GIF )文件、 流式网络图形格式 ( Portable Network Graphic Format, PNG )文件)等等。 页面开发者在编写具 体页面代码过程中, 可能会存在 HTML文件中多次使用同一个外链文件, 但 是在 HTML文件中对应的外链文件的路径可能不同。 例如: test.jpg文件在服 务器 home文件夹下, 针对 home文件夹下的 test.jpg文件, 在页面中可能出 现如下外链文件的路径写法, 分别记为: 路径 1、 路径 2:  The Internet has developed rapidly. Its main carrier is HTML pages based on Hyper Text Mark-up Language (HTML) encoded files. In HTML pages, a large number of external links are used, such as: script files (such as JavaScript). File), Cascading Style Sheet (CSS) files, image files (such as bitmap images (BMP) files, Joint Photographic Experts Group (JPEG) files, image interchange formats (Graphics Interchange) Format, GIF) files, Portable Network Graphic Format (PNG) files, and more. In the process of writing a specific page code, the page developer may use the same outer chain file multiple times in the HTML file, but the path of the corresponding outer chain file in the HTML file may be different. For example: test.jpg file in the server home folder, for the test.jpg file in the home folder, the following path of the external link file may appear in the page, respectively: path 1, path 2:

路径 1 : htt ://127.0.0.1 /home/webserver/, ./test.jpg;  Path 1 : htt ://127.0.0.1 /home/webserver/, ./test.jpg;

路径 2: htt ://127.0.0.1 /home/httpserver/../test.jpg;  Path 2: htt ://127.0.0.1 /home/httpserver/../test.jpg;

上述路径 1、 路径 2其实都是指向服务器 home目录下的 test.jpg文件,其 针对终端来讲, 该文件的绝对路径为:  The above path 1, path 2 is actually pointing to the test.jpg file in the server home directory, for the terminal, the absolute path of the file is:

http :〃127.0.0.1 /home/test.jpg。  Http :〃127.0.0.1 /home/test.jpg.

但在终端浏览器中当解析到外链文件的路径时, 分别解析成两个不同的 路径统一资源定位符(Uniform / Universal Resource Locator, URL ) , 向业务 服务器发起资源访问的请求。 虽然一般浏览器将路径 1与路径 2是不同的两 个 URL, 其实是指向业务服务器上同一个外链文件, 但是终端浏览器却向业 务服务器发送两次请求, 对业务服务器资源和终端设备的资源都存在浪费。 当 Web文件出现有大量的外链文件相同而路径不同的情况时, 大量的终端设 备同时访问会极易引起业务服务器过载, 给系统运行带来一定的风险。 发明内容 However, when parsing the path to the external link file in the terminal browser, it parses into two different Uniform / Universal Resource Locators (URLs), and initiates a resource access request to the service server. Although the general browser will have two URLs with different paths 1 and 2, which are actually pointing to the same external file on the service server, the terminal browser sends two requests to the service server, for the service server resources and the terminal devices. Resources are wasted. When a large number of external file files have the same path and different paths, the large number of terminal devices accessing at the same time can easily cause overload of the service server, which brings certain risks to the system operation. Summary of the invention

本发明实施例要解决的技术问题是提供一种访问网络资源的优化方法、 The technical problem to be solved by the embodiments of the present invention is to provide an optimization method for accessing network resources.

Web浏览器和终端, 以避免针对具有不同路径的外链文件向业务服务器进行 多次请求访问, 从而达到节省网络资源和设备本身资源的目的。 The web browser and the terminal are used to avoid multiple requests for access to the service server for the external link files with different paths, thereby saving the network resources and the resources of the device itself.

为了解决上述技术问题, 本发明实施例提供了一种访问网络资源的优化 方法, 包括:  In order to solve the above technical problem, an embodiment of the present invention provides an optimization method for accessing network resources, including:

接收到访问外链文件的请求后, 从所述外链文件在页面中的路径统一资 源定位符(URL ) 中解析出所述外链文件在业务服务器中的绝对路径;  After receiving the request for accessing the external link file, parsing the absolute path of the outer chain file in the service server from the path uniform resource locator (URL) of the outer link file in the page;

检测是否緩存有所述绝对路径对应的文件数据, 若是, 则取消所述访问 外链文件的请求; 若否, 则发起所述访问外链文件的请求。  Detecting whether the file data corresponding to the absolute path is cached, and if so, canceling the request to access the outer chain file; if not, initiating the request to access the outer chain file.

上述方法还具有下面特点: 所述发起所述访问外链文件的请求之后, 还 包括:  The foregoing method further has the following features: after the request for the access to the external link file is initiated, the method further includes:

下载所述外链文件对应的文件数据, 并保存所述绝对路径与下载的文件 数据的对应关系。  The file data corresponding to the outer chain file is downloaded, and the correspondence between the absolute path and the downloaded file data is saved.

上述方法还具有下面特点:所述从所述外链文件在页面中的路径 URL中 解析出所述外链文件在业务服务器中的绝对路径的步骤包括:  The foregoing method further has the following feature: the step of parsing the absolute path of the outer chain file in the service server from the path URL in the page of the outer chain file includes:

判断所述路径 URL是否包括文件路径符号, 若否, 则将所述路径 URL 作为所述外链文件在业务服务器中的绝对路径; 若是, 则根据所述文件路径 符号的含义进行简化处理得到所述外链文件在业务服务器中的绝对路径。  Determining whether the path URL includes a file path symbol, and if not, using the path URL as an absolute path of the outer chain file in the service server; if yes, performing simplification processing according to the meaning of the file path symbol The absolute path of the outer chain file in the business server.

上述方法还具有下面特点: 所述外链文件包括脚本文件、 层叠样式表文 件和图像文件中的一种或多种。  The above method also has the following features: The outer chain file includes one or more of a script file, a cascading style sheet file, and an image file.

为了解决上述问题, 本发明还提供了一种网页浏览器, 包括:  In order to solve the above problems, the present invention further provides a web browser, including:

解析模块, 其设置为: 接收到访问外链文件的请求后, 从所述外链文件 在页面中的路径统一资源定位符(URL ) 中解析出所述外链文件在业务服务 器中的绝对路径; 以及 访问处理模块, 其设置为: 检测是否緩存有所述绝对路径对应的文件数 据, 若有, 则取消所述访问外链文件的请求; 若没有, 则发起所述访问外链 文件的请求。 a parsing module, configured to: after receiving the request for accessing the outer chain file, parsing the absolute path of the outer chain file in the service server from the path uniform resource locator (URL) of the outer chain file in the page ; as well as The access processing module is configured to: detect whether the file data corresponding to the absolute path is cached, and if yes, cancel the request for accessing the outer chain file; if not, initiate the request for accessing the outer chain file.

上述网页浏览器还具有下面特点: 还包括:  The above web browser also has the following features:

下载模块, 其设置为: 在所述访问处理模块发起所述访问外链文件的请 求后, 下载所述外链文件对应的文件数据。  And a downloading module, configured to: after the access processing module initiates the request for accessing the outer chain file, download the file data corresponding to the outer chain file.

上述网页浏览器还具有下面特点: 还包括:  The above web browser also has the following features:

緩存模块, 其设置为: 保存所述绝对路径与所述下载模块下载的文件数 据的对应关系。  a cache module, configured to: save a correspondence between the absolute path and file data downloaded by the download module.

上述网页浏览器还具有下面特点:  The above web browser also has the following features:

所述解析模块是设置为: 接收到访问外链文件的请求后, 判断所述路径 URL是否包括文件路径符号,若没有,则将所述路径 URL作为所述外链文件 在业务服务器中的绝对路径; 若有, 则根据所述文件路径符号的含义进行简 化处理得到所述外链文件在业务服务器中的绝对路径。  The parsing module is configured to: after receiving the request for accessing the outer chain file, determine whether the path URL includes a file path symbol, and if not, use the path URL as an absolute of the outer chain file in the service server. a path; if yes, performing a simplified process according to the meaning of the file path symbol to obtain an absolute path of the outer chain file in the service server.

上述网页浏览器还具有下面特点: 所述外链文件包括脚本文件、 层叠样 式表文件和图像文件中的一种或多种。  The above web browser also has the following features: The outer chain file includes one or more of a script file, a cascading style sheet file, and an image file.

为了解决上述问题, 本发明还提供了一种终端, 包括上述的网页浏览器。 综上, 本发明实施例提供一种访问网络资源的优化方法、 Web浏览器和 终端, 既能够正确访问到外链文件, 并且能实现外联文件路径甄别处理, 同 一个外链文件即使不同路径可以避免向业务服务器多次请求访问, 从而达到 节省网络资源和设备本身资源的目的。 附图概述  In order to solve the above problems, the present invention also provides a terminal, including the above web browser. In summary, the embodiments of the present invention provide an optimization method for accessing network resources, a web browser, and a terminal, which can correctly access external file files, and can implement an external file path screening process, and the same external chain file has different paths. You can avoid requesting access to the service server multiple times, so as to save network resources and resources of the device itself. BRIEF abstract

图 1为本发明实施例的 Web浏览器的示意图;  FIG. 1 is a schematic diagram of a web browser according to an embodiment of the present invention; FIG.

图 2是本发明的一种访问网络资源的优化方法的流程图;  2 is a flowchart of an optimization method for accessing network resources according to the present invention;

图 3是本发明实施例的一种访问网络资源的优化方法的流程图。 本发明的较佳实施方式 FIG. 3 is a flowchart of an optimization method for accessing network resources according to an embodiment of the present invention. Preferred embodiment of the invention

下文中将结合附图对本发明的实施例进行详细说明。 需要说明的是, 在 不冲突的情况下, 本申请中的实施例及实施例中的特征可以相互任意组合。  Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, in the case of no conflict, the features in the embodiments and the embodiments in the present application may be arbitrarily combined with each other.

图 1为本发明实施例的 Web浏览器的示意图, 如图 1所示, 本实施例的 Web浏览器包括:  FIG. 1 is a schematic diagram of a web browser according to an embodiment of the present invention. As shown in FIG. 1, the web browser of this embodiment includes:

解析模块, 设置为接收到访问外链文件的请求后, 从所述外链文件在页 面中的路径 URL中解析出所述外链文件在业务服务器中的绝对路径;  The parsing module is configured to parse the absolute path of the outer chain file in the service server from the path URL in the page of the outer chain file after receiving the request for accessing the outer chain file;

访问处理模块, 设置为检测是否緩存有所述绝对路径对应的文件数据, 若有, 则取消所述访问外链文件的请求; 若没有, 则发起所述访问外链文件 的请求。  The access processing module is configured to detect whether the file data corresponding to the absolute path is cached, and if yes, cancel the request for accessing the outer chain file; if not, initiate the request for accessing the outer chain file.

其中, 所述解析模块是设置为接收到访问外链文件的请求后, 判断所述 路径 URL是否包括文件路径符号, 若没有, 则将所述路径 URL作为所述外 链文件在业务服务器中的绝对路径; 若有, 则根据所述文件路径符号的含义 进行简化处理得到所述外链文件在业务服务器中的绝对路径。  The parsing module is configured to: after receiving the request for accessing the outer chain file, determine whether the path URL includes a file path symbol, and if not, use the path URL as the outer chain file in the service server. Absolute path; if yes, the simplified process is performed according to the meaning of the file path symbol to obtain an absolute path of the outer chain file in the service server.

本实施例中, 所述 Web浏览器还可以包括:  In this embodiment, the web browser may further include:

下载模块,设置为在所述访问处理模块发起所述访问外链文件的请求后, 下载所述外链文件对应的文件数据。  The downloading module is configured to download the file data corresponding to the outer chain file after the access processing module initiates the request for accessing the outer chain file.

緩存模块, 设置为保存所述绝对路径与所述下载模块下载的文件数据的 对应关系。  The cache module is configured to save a correspondence between the absolute path and the file data downloaded by the download module.

其中, 所述外链文件包括脚本文件、 层叠样式表文件和图像文件中的一 种或多种。  The outer chain file includes one or more of a script file, a cascading style sheet file, and an image file.

本发明还提供一种终端, 该终端包括上述的 Web浏览器。  The invention also provides a terminal comprising the above web browser.

图 2是本发明实施例的一种访问网络资源的优化方法的流程图, 如图 2 所示, 该方法包括下面步骤:  2 is a flowchart of an optimization method for accessing network resources according to an embodiment of the present invention. As shown in FIG. 2, the method includes the following steps:

S201、 接收到访问外链文件的请求后, 从所述外链文件在页面中的路径 S201. After receiving the request for accessing the outer chain file, the path from the outer chain file in the page

URL中解析出所述外链文件在业务服务器中的绝对路径; The absolute path of the outer chain file in the service server is parsed in the URL;

S202、 检测是否緩存有所述绝对路径对应的文件数据, 若有, 则取消所 述访问外链文件的请求; 若没有, 则发起所述访问外链文件的请求。 S202. Detect whether the file data corresponding to the absolute path is cached, and if yes, cancel the A request to access an outer chain file; if not, a request to access the outer chain file is initiated.

本实施例的方法对于 Web页面中具有多路径的外链文件,可以避免向业 务服务器发起多次请求, 从而造成资源浪费的问题。  The method in this embodiment can avoid the problem of wasting resources by initiating multiple requests to the service server for the external link file with multipath in the web page.

本发明实施例重新计算 Web浏览器解析外链文件在页面中的路径 URL, 例如, 将路径 URL中类似 "../" 、 "./" 、 "//" 等路径符号进行简化计算, 计算出来的结果是不包含类似 "../" 、 "./" 、 "//" 等符号的外链文件的绝 对路径, 以便 Web浏览器来进行外链文件相关数据检测。  The embodiment of the present invention recalculates the path URL of the web browser for parsing the outer chain file in the page, for example, simplifying calculation of path symbols such as "../", "./", "//" in the path URL, and calculating The result is an absolute path that does not contain external links such as "../", "./", "//", etc., so that the web browser can detect the data related to the external link file.

在 Web浏览器终端侧引入文件緩存功能, 即将已经访问过的外链文件的 数据保存起来, 此外也保存外链文件数据与该外链文件的绝对路径的映射关 系。  The file caching function is introduced on the terminal side of the web browser, and the data of the external chain file that has been accessed is saved, and the mapping relationship between the outer chain file data and the absolute path of the outer chain file is also saved.

图 3是本发明实施例的访问网络资源的优化方法的流程图,如图 3所示, 包括下面步骤:  FIG. 3 is a flowchart of an optimization method for accessing network resources according to an embodiment of the present invention. As shown in FIG. 3, the method includes the following steps:

步骤 301、 Web浏览器接收到访问外链文件的请求;  Step 301: The web browser receives a request for accessing an external link file.

步骤 302、 Web浏览器解析 Web页面, 从所述外链文件在页面中编码指 定的路径 URL解析出绝对路径;  Step 302: The web browser parses the web page, and parses the absolute path from the path URL specified by the outer chain file in the page;

该步骤中, 当 Web浏览器解析外链文件在页面中定义的路径 URL后, 判断该路径 URL是否存在文件路径符号, 如 "../" "./" "//" 等, 如没有上 述路径符号, 则不需要进行路径简化处理, 直接返回路径 URL; 如果路径包 含上述路径符号,则需要根据符号含义进行路径简化处理,处理后的路径 URL 即为外链文件在业务服务器中的绝对路径。  In this step, when the web browser parses the path URL defined by the outer chain file in the page, it is determined whether the path URL has a file path symbol, such as "../" "./" "//", etc., if none of the above If the path symbol does not need to be simplified, the path URL is directly returned. If the path contains the path symbol, the path is simplified according to the meaning of the symbol. The processed path URL is the absolute path of the external link file in the service server. .

步骤 303、 Web浏览器检测绝对路径对应的文件数据是否已经緩存过, 如果緩存过, 则转向步骤 304; 如果没有緩存, 则转向步骤 305;  Step 303, the web browser detects whether the file data corresponding to the absolute path has been cached, if the cache has passed, then proceeds to step 304; if there is no cache, then proceeds to step 305;

步骤 304、 直接使用緩存的相关文件数据;  Step 304: directly use the cached related file data;

步骤 305、 下载相关文件数据, 下载完成后緩存该文件数据, 并保存该 文件的绝对路径和文件数据的对应关系, 以便后续查询。  Step 305: Download related file data, cache the file data after the download is completed, and save the correspondence between the absolute path of the file and the file data for subsequent query.

本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序 来指令相关硬件完成, 所述程序可以存储于计算机可读存储介质中, 如只读 存储器、 磁盘或光盘等。 可选地, 上述实施例的全部或部分步骤也可以使用 一个或多个集成电路来实现。 相应地, 上述实施例中的各模块 /单元可以釆用 硬件的形式实现, 也可以釆用软件功能模块的形式实现。 本发明不限制于任 何特定形式的硬件和软件的结合。 One of ordinary skill in the art can understand that all or part of the above steps can be completed by a program to instruct related hardware, and the program can be stored in a computer readable storage medium, such as read only. Memory, disk or disc, etc. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the foregoing embodiment may be implemented in the form of hardware, or may be implemented in the form of a software function module. The invention is not limited to any specific form of combination of hardware and software.

以上仅为本发明的优选实施例, 当然, 本发明还可有其他多种实施例, 在不背离本发明精神及其实质的情况下, 熟悉本领域的技术人员当可根据本 发明作出各种相应的改变和变形, 但这些相应的改变和变形都应属于本发明 所附的权利要求的保护范围。 The above is only a preferred embodiment of the present invention, and of course, the present invention may be embodied in various other embodiments without departing from the spirit and scope of the invention. Corresponding changes and modifications are intended to be included within the scope of the appended claims.

工业实用性 Industrial applicability

本发明实施例提供一种访问网络资源的优化方法、 Web浏览器和终端, 既能够正确访问到外链文件, 并且能实现外联文件路径甄别处理, 同一个外 链文件即使不同路径可以避免向业务服务器多次请求访问, 从而达到节省网 络资源和设备本身资源的目的。  The embodiments of the present invention provide an optimization method for accessing network resources, a web browser, and a terminal, which can correctly access external file files, and can implement an external file path screening process, and the same external chain file can be avoided even if different paths are used. The service server requests access multiple times, thereby saving network resources and resources of the device itself.

Claims

权 利 要 求 书 Claim 1、 一种访问网络资源的优化方法, 其包括:  1. An optimization method for accessing network resources, comprising: 接收到访问外链文件的请求后, 从所述外链文件在页面中的路径统一资 源定位符(URL ) 中解析出所述外链文件在业务服务器中的绝对路径;  After receiving the request for accessing the external link file, parsing the absolute path of the outer chain file in the service server from the path uniform resource locator (URL) of the outer link file in the page; 检测是否緩存有所述绝对路径对应的文件数据, 若是, 则取消所述访问 外链文件的请求; 若否, 则发起所述访问外链文件的请求。  Detecting whether the file data corresponding to the absolute path is cached, and if so, canceling the request to access the outer chain file; if not, initiating the request to access the outer chain file. 2、 如权利要求 1所述的方法, 其中: 所述发起所述访问外链文件的请求 之后, 所述方法还包括:  2. The method of claim 1, wherein: the method further comprises: after initiating the request to access the outer chain file, the method further comprising: 下载所述外链文件对应的文件数据, 并保存所述绝对路径与下载的文件 数据的对应关系。  The file data corresponding to the outer chain file is downloaded, and the correspondence between the absolute path and the downloaded file data is saved. 3、 如权利要求 1所述的方法, 其中: 所述从所述外链文件在页面中的路 径 URL中解析出所述外链文件在业务服务器中的绝对路径的步骤包括: 判断所述路径 URL是否包括文件路径符号, 若否, 则将所述路径 URL 作为所述外链文件在业务服务器中的绝对路径; 若是, 则根据所述文件路径 符号的含义进行简化处理得到所述外链文件在业务服务器中的绝对路径。  3. The method according to claim 1, wherein: the step of parsing the absolute path of the outer chain file in the service server from the path URL in the page of the outer chain file comprises: determining the path Whether the URL includes a file path symbol, and if not, the path URL is used as an absolute path of the outer chain file in the service server; if yes, the simplified processing is performed according to the meaning of the file path symbol to obtain the outer chain file. Absolute path in the business server. 4、 如权利要求 1-3任一项所述的方法, 其中:  4. The method of any of claims 1-3, wherein: 所述外链文件包括脚本文件、 层叠样式表文件和图像文件中的一种或多 种。  The outer chain file includes one or more of a script file, a cascading style sheet file, and an image file. 5、 一种网页浏览器, 其包括:  5. A web browser comprising: 解析模块, 其设置为: 接收到访问外链文件的请求后, 从所述外链文件 在页面中的路径统一资源定位符(URL ) 中解析出所述外链文件在业务服务 器中的绝对路径; 以及  a parsing module, configured to: after receiving the request for accessing the outer chain file, parsing the absolute path of the outer chain file in the service server from the path uniform resource locator (URL) of the outer chain file in the page ; as well as 访问处理模块, 其设置为: 检测是否緩存有所述绝对路径对应的文件数 据, 若是, 则取消所述访问外链文件的请求; 若否, 则发起所述访问外链文 件的请求。  And an access processing module, configured to: detect whether the file data corresponding to the absolute path is cached, and if yes, cancel the request for accessing the outer chain file; if not, initiate the request for accessing the outer chain file. 6、 如权利要求 5所述的网页浏览器, 所述网页浏览器还包括: 下载模块, 其设置为: 在所述访问处理模块发起所述访问外链文件的请 求后, 下载所述外链文件对应的文件数据。 The web browser of claim 5, the web browser further comprising: a downloading module, configured to: initiate the accessing the outer chain file in the access processing module After the request, the file data corresponding to the outer chain file is downloaded. 7、 如权利要求 6所述的网页浏览器, 所述网页浏览器还包括: 緩存模块, 其设置为: 保存所述绝对路径与所述下载模块下载的文件数 据的对应关系。  7. The web browser of claim 6, the web browser further comprising: a cache module, configured to: save a correspondence between the absolute path and file data downloaded by the download module. 8、 如权利要求 5所述的网页浏览器, 其中:  8. The web browser of claim 5, wherein: 所述解析模块是设置为: 接收到访问外链文件的请求后, 判断所述路径 URL是否包括文件路径符号,若没有,则将所述路径 URL作为所述外链文件 在业务服务器中的绝对路径; 若有, 则根据所述文件路径符号的含义进行简 化处理得到所述外链文件在业务服务器中的绝对路径。  The parsing module is configured to: after receiving the request for accessing the outer chain file, determine whether the path URL includes a file path symbol, and if not, use the path URL as an absolute of the outer chain file in the service server. a path; if yes, performing a simplified process according to the meaning of the file path symbol to obtain an absolute path of the outer chain file in the service server. 9、 如权利要求 5-8任一项所述的网页浏览器, 其中:  9. The web browser of any of claims 5-8, wherein: 所述外链文件包括脚本文件、 层叠样式表文件和图像文件中的一种或多 种。  The outer chain file includes one or more of a script file, a cascading style sheet file, and an image file. 10、 一种终端, 其包括: 如权利要求 5-9任一项所述的网页浏览器。  A terminal comprising: a web browser according to any one of claims 5-9.
PCT/CN2012/073216 2011-06-15 2012-03-29 Network resource access optimization method, web browser, and terminal Ceased WO2012171391A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110160654.7 2011-06-15
CN2011101606547A CN102214224A (en) 2011-06-15 2011-06-15 Network resource access optimizing method, Web page browser and terminal

Publications (1)

Publication Number Publication Date
WO2012171391A1 true WO2012171391A1 (en) 2012-12-20

Family

ID=44745532

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/073216 Ceased WO2012171391A1 (en) 2011-06-15 2012-03-29 Network resource access optimization method, web browser, and terminal

Country Status (2)

Country Link
CN (1) CN102214224A (en)
WO (1) WO2012171391A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081633A (en) * 2009-11-27 2011-06-01 阿里巴巴集团控股有限公司 JavaScript file management method, device and system
CN102214224A (en) * 2011-06-15 2011-10-12 中兴通讯股份有限公司 Network resource access optimizing method, Web page browser and terminal
CN103294718A (en) * 2012-02-29 2013-09-11 腾讯科技(深圳)有限公司 Method and device for web page cache management
CN103795690B (en) * 2012-10-31 2017-08-11 华为技术有限公司 A kind of method, proxy server and the system of cloud access control
CN103391285B (en) * 2013-07-03 2016-12-28 杭州华三通信技术有限公司 The apparatus and method that a kind of web access optimizes
CN104348803B (en) * 2013-07-31 2018-12-11 深圳市腾讯计算机系统有限公司 Link kidnaps detection method, device, user equipment, Analysis server and system
CN103763340B (en) * 2013-12-24 2017-07-04 新华三技术有限公司 A kind of apparatus and method of web access optimization
CN107239475B (en) * 2016-03-29 2020-09-18 阿里巴巴集团控股有限公司 File calling method and device
CN107704464B (en) * 2016-08-08 2021-05-07 北京国双科技有限公司 Method and device for analyzing path of static resource

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1552024A (en) * 2001-08-03 2004-12-01 ��˹��ŵ�� Method, system and terminal for data network with distributed cache
CN1960512A (en) * 2005-11-03 2007-05-09 乐金电子(中国)研究开发中心有限公司 Method for caching hypertext data in mobile communication terminal and mobile communication terminal thereof
CN101719936A (en) * 2009-12-09 2010-06-02 成都市华为赛门铁克科技有限公司 Method, device and cache system for providing file downloading service
CN102214224A (en) * 2011-06-15 2011-10-12 中兴通讯股份有限公司 Network resource access optimizing method, Web page browser and terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1552024A (en) * 2001-08-03 2004-12-01 ��˹��ŵ�� Method, system and terminal for data network with distributed cache
CN1960512A (en) * 2005-11-03 2007-05-09 乐金电子(中国)研究开发中心有限公司 Method for caching hypertext data in mobile communication terminal and mobile communication terminal thereof
CN101719936A (en) * 2009-12-09 2010-06-02 成都市华为赛门铁克科技有限公司 Method, device and cache system for providing file downloading service
CN102214224A (en) * 2011-06-15 2011-10-12 中兴通讯股份有限公司 Network resource access optimizing method, Web page browser and terminal

Also Published As

Publication number Publication date
CN102214224A (en) 2011-10-12

Similar Documents

Publication Publication Date Title
WO2012171391A1 (en) Network resource access optimization method, web browser, and terminal
US10015226B2 (en) Methods for making AJAX web applications bookmarkable and crawlable and devices thereof
JP6173546B2 (en) Redirect reduction
CN103365695B (en) Method and device for increasing sub-resource loading speed
US9407727B1 (en) Optimizing communications using client-side reconstruction scripting
US8868638B2 (en) Methods for reducing latency in network connections using automatic redirects and systems thereof
WO2012155849A1 (en) Webpage browsing method, proxy server and webpage browsing system
CN103500194A (en) Method, device and browser for loading webpage
WO2010081336A1 (en) Web page displaying method, request processing method, apparatus and system
CN109815430B (en) Request processing method and device, data processing server and readable storage medium
CN103631905A (en) Webpage loading method and browser
WO2010051766A1 (en) Method and device for acquiring target resource information
CN103530329A (en) Method and device for performing webpage loading and browsers
US10983996B2 (en) Asynchronous predictive caching of content listed in search results
CN116382604B (en) Method, system, storage medium and equipment for printing PDF (portable document format) file on webpage
CN104980464B (en) A kind of network request processing method, network server and network system
WO2015154270A1 (en) Method and device for information search
KR101046446B1 (en) Web page loading method and system
CN102694802B (en) Network access information recording method and device
US20070124667A1 (en) Verifying content of resources in markup language documents
WO2011157183A2 (en) Investigation method and system for web application hosting
CN110955851B (en) Network request processing method, system and computing device
EP2041660A2 (en) Conditional url for computer devices
Ahmed Transcoding Web Pages For Energy Saving On the Client-Side
CN103500199B (en) A kind of webpage based on pre-loaded cloud template renders acceleration method and system

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: 12800773

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12800773

Country of ref document: EP

Kind code of ref document: A1