CN103258055B - A kind of file download equipment and method - Google Patents
A kind of file download equipment and method Download PDFInfo
- Publication number
- CN103258055B CN103258055B CN201310214543.9A CN201310214543A CN103258055B CN 103258055 B CN103258055 B CN 103258055B CN 201310214543 A CN201310214543 A CN 201310214543A CN 103258055 B CN103258055 B CN 103258055B
- Authority
- CN
- China
- Prior art keywords
- file
- value
- storage unit
- call request
- particular attribute
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Human Computer Interaction (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明提供了一种文件下载设备,包括:网页解析模块,适于在浏览器侧加载网页页面时,接收所述页面对文件的调用请求;文件判断模块,适于判断所述文件是否存在于在浏览器侧预置的文件存储单元中;以及文件下载模块,适于在存在所述文件时直接从所述文件存储单元中获取所述文件,不存在所述文件时根据所述调用请求从所述网页对应的服务器下载所述文件。本发明还提供了相应的文件下载方法。根据本发明,在浏览器侧内置一些网络资源,提高了网站的响应速度。
The present invention provides a file downloading device, comprising: a webpage parsing module, adapted to receive a call request from the page for a file when a webpage is loaded on the browser side; a file judging module, adapted to judge whether the file exists in In the file storage unit preset on the browser side; and a file download module, adapted to obtain the file directly from the file storage unit when the file exists, and obtain the file according to the calling request when the file does not exist The server corresponding to the web page downloads the file. The invention also provides a corresponding file downloading method. According to the present invention, some network resources are built in the browser side, which improves the response speed of the website.
Description
技术领域technical field
本发明涉及互联网领域,具体涉及一种文件下载设备和相应的文件下载方法。The invention relates to the field of the Internet, in particular to a file downloading device and a corresponding file downloading method.
背景技术Background technique
据统计数据表明,在世界前10000个访问最多的网站中,有超过55%在使用jQuery,这是一个兼容多种浏览器的、免费的、开源的javascript库,可以使开发者能更方便地处理HTML文档、事件并实现动画效果等,轻松的开发出功能强大的静态或动态网页。According to statistics, more than 55% of the top 10,000 most visited websites in the world are using jQuery, which is a free, open source javascript library compatible with multiple browsers, which allows developers to more easily Process HTML documents, events and achieve animation effects, etc., and easily develop powerful static or dynamic web pages.
用户在使用浏览器浏览网站时,浏览器会自动从网站上下载jQuery脚本库,以实现本地网页能够呈现多种js的交互效果;浏览器自动从网站上下载jQuery脚本库可能需要花一定时间,尤其是在网络状态不太好的情况下所耗时间会明显的影响网页的响应速度,延长了用户的等待时间。When a user browses a website with a browser, the browser will automatically download the jQuery script library from the website, so that the local webpage can present a variety of js interactive effects; it may take some time for the browser to automatically download the jQuery script library from the website. Especially when the network status is not good, the time spent will significantly affect the response speed of the web page and prolong the user's waiting time.
为了提高网站访问速度,本地用户端会自动将已经访问过的网站内容存入本地浏览器的缓存里,一旦再对这个网站进行访问,则可直接从本地缓存取出该网站内容进行加载显示。浏览器本身的缓存机制,能够使得用户端在第二次访问相同的网络资源时直接从本地缓存中进行调用,但用户第一次访问网络资源时还必须得从网络上下载网络资源。因此,对于第一次访问的新用户,下载该网络资源一定会造成一定的响应延迟。In order to improve the website access speed, the local client will automatically store the visited website content in the cache of the local browser. Once the website is accessed again, the website content can be directly fetched from the local cache for loading and displaying. The caching mechanism of the browser itself can enable the client to directly call from the local cache when accessing the same network resource for the second time, but the user must download the network resource from the network when accessing the network resource for the first time. Therefore, for a new user visiting for the first time, downloading the network resource will definitely cause a certain response delay.
发明内容Contents of the invention
鉴于上述问题,本发明提供一种文件下载设备以及相应的文件下载方法,以便克服上述问题或者至少部分地解决上述问题。In view of the above problems, the present invention provides a file downloading device and a corresponding file downloading method, so as to overcome the above problems or at least partly solve the above problems.
根据本发明的一个方面,提供一种文件下载设备,包括:According to one aspect of the present invention, a file download device is provided, comprising:
网页解析模块,适于在浏览器侧加载网页页面时,接收所述页面对文件的调用请求;The web page parsing module is suitable for receiving the calling request of the page for the file when the web page is loaded on the browser side;
文件判断模块,适于判断所述文件是否存在于浏览器侧预置的文件存储单元中;以及A file judging module, adapted to judge whether the file exists in the file storage unit preset on the browser side; and
文件下载模块,适于File download module, suitable for
若存在所述文件,则直接从所述文件存储单元中获取所述文件;和If the file exists, obtaining the file directly from the file storage unit; and
若不存在所述文件,则根据所述调用请求从所述网页对应的服务器下载所述文件。If the file does not exist, the file is downloaded from the server corresponding to the web page according to the calling request.
可选地,所述文件存储单元中存储有以其特定属性值命名的多个文件,其中文件判断模块适于根据所述调用请求是否包含与所述文件存储单元中的文件相匹配的文件名来判断是否存在所述文件。Optionally, multiple files named after their specific attribute values are stored in the file storage unit, wherein the file judging module is adapted to include a file name matching the file in the file storage unit according to whether the call request contains to determine whether the file exists.
可选地,所述文件判断模块适于:若所述调用请求包含特定字段,且与所述特定字段相关联的值与文件存储单元中的文件的文件名相匹配,则判断存在所述文件;若所述调用请求所包含的特定字段相关联的值与所述文件存储单元中的文件的文件名不匹配,或所述调用请求不包含所述特定字段,则判断不存在所述文件。Optionally, the file judging module is adapted to: if the call request contains a specific field, and the value associated with the specific field matches the file name of the file in the file storage unit, then judge that the file exists ; If the value associated with the specific field contained in the call request does not match the file name of the file in the file storage unit, or the call request does not contain the specific field, then determine that the file does not exist.
可选地,所述文件下载设备还包括:Optionally, the file downloading device also includes:
文件名计算模块,适于获取所述文件下载模块下载的文件的特定属性值,以及文件存储模块,适于若所述文件属性值与所述调用请求包含的特定字段的值相匹配,则在文件存储单元中存储所下载的文件并以该特定属性值命名;和若所述文件属性值与所述调用请求包含的特定字段的值不匹配,则不存储所下载的文件。The file name calculation module is adapted to obtain the specific attribute value of the file downloaded by the file download module, and the file storage module is adapted to match the value of the specific field included in the call request if the file attribute value matches the value of the specified field in the call request. The downloaded file is stored in the file storage unit and named after the specific attribute value; and if the file attribute value does not match the value of the specific field contained in the call request, the downloaded file is not stored.
可选地,所述特定属性值为对文件内容进行哈希计算后获得的值。Optionally, the specific attribute value is a value obtained after performing a hash calculation on the file content.
可选地,所述文件为javascript脚本文件。Optionally, the file is a javascript script file.
根据本发明的另一方面,提供一种文件下载方法,包括:According to another aspect of the present invention, a file download method is provided, comprising:
在浏览器侧加载网页页面时,接收所述页面对文件的调用请求;When the web page is loaded on the browser side, receiving the calling request of the page for the file;
判断所述文件是否存在于在浏览器侧预置的文件存储单元中;Judging whether the file exists in the file storage unit preset on the browser side;
若存在所述文件,则直接从所述存储单元中获取所述文件;和If the file exists, obtaining the file directly from the storage unit; and
若不存在所述文件,则根据所述调用请求从所述网页对应的服务器下载所述文件。If the file does not exist, the file is downloaded from the server corresponding to the web page according to the calling request.
可选地,所述文件存储单元中存储有以其特定属性值命名的多个文件,其中判断步骤根据所述调用请求是否包含与所述文件存储单元中的文件相匹配的文件名来判断是否存在所述文件。Optionally, multiple files named after their specific attribute values are stored in the file storage unit, wherein the judging step judges whether Said file exists.
可选地,所述判断步骤包括:若所述调用请求包含特定字段,且与所述特定字段相关联的值与文件存储单元中的文件的文件名相匹配,则判断存在所述文件;以及若所述调用请求所包含的特定字段相关联的值与所述文件存储单元中的文件的文件名不匹配,或所述调用请求不包含所述特定字段,则判断不存在所述文件。Optionally, the judging step includes: if the call request contains a specific field, and the value associated with the specific field matches the file name of the file in the file storage unit, then judging that the file exists; and If the value associated with the specific field contained in the call request does not match the file name of the file in the file storage unit, or the call request does not contain the specific field, it is determined that the file does not exist.
可选地,所述文件下载方法还包括:获取所下载的文件的特定属性值,以及若所述文件属性值与所述调用请求包含的特定字段的值相匹配,则在文件存储单元中存储所下载的文件并以该特定属性值命名;若所述文件属性值与所述调用请求包含的特定字段的值不匹配,则不存储所下载的文件。Optionally, the file download method further includes: obtaining a specific attribute value of the downloaded file, and if the file attribute value matches the value of a specific field contained in the call request, storing the file in the file storage unit The downloaded file is named after the specific attribute value; if the file attribute value does not match the value of the specific field contained in the call request, the downloaded file is not stored.
可选地,所述特定属性值为对文件内容进行哈希计算后获得的值。Optionally, the specific attribute value is a value obtained after performing a hash calculation on the file content.
可选地,所述文件为javascript脚本文件。Optionally, the file is a javascript script file.
本发明提供的文件下载设备和相应的文件下载方法,通过在本地预置包含有多文件的文件存储单元,使得浏览器在访问网络页面需要调用文件时,首先查找本地的文件存储单元中是否存在所需的待调用的文件,若存在时则直接调用本地文件,而无需从网络上进行下载,这样就能避免浏览器因从网站服务器上下载文件而造成网页响应时间过长,快速的网页响应速度能够大大提高用户体验满意度。The file downloading device and the corresponding file downloading method provided by the present invention preset a file storage unit containing multiple files locally, so that when the browser needs to call a file when accessing a network page, it first searches whether there is a file in the local file storage unit. If the required file to be called exists, it will directly call the local file without downloading it from the network, so as to avoid the long response time of the webpage caused by the browser downloading the file from the website server, and the fast webpage response Speed can greatly improve user experience satisfaction.
进一步地,本发明提供的文件下载设备和方法,通过下载文件的特定属性值,对下载文件的正确性进行验证;如果正确,则将其存储在文件存储单元中,实现了文件存储单元中文件的安全添加,也使得本发明的文件下载设备和方法能够节省更多网络资源的下载时间。Further, the file downloading device and method provided by the present invention verify the correctness of the downloaded file through the specific attribute value of the downloaded file; if it is correct, it is stored in the file storage unit, realizing the The security addition also enables the file downloading device and method of the present invention to save more downloading time of network resources.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:
图1示出了根据本发明一个实施例的文件下载设备结构示意图;以及FIG. 1 shows a schematic structural diagram of a file downloading device according to an embodiment of the present invention; and
图2示出了根据本发明一个实施例的文件下载方法的流程示意图。Fig. 2 shows a schematic flowchart of a file downloading method according to an embodiment of the present invention.
具体实施方式detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
图1示出了根据本发明一实施例的文件下载设备的结构示意图,包括:网页解析模块101,文件判断模块102,文件下载模块103,文件存储单元104,文件名计算模块105和文件存储模块106。在本发明中,所述文件下载设备可以是计算机浏览器终端,也可以是手机等能接入互联网进行网页浏览的其他电子设备。Fig. 1 shows a schematic structural diagram of a file downloading device according to an embodiment of the present invention, including: a web page parsing module 101, a file judging module 102, a file downloading module 103, a file storage unit 104, a file name calculation module 105 and a file storage module 106. In the present invention, the file downloading device may be a computer browser terminal, or other electronic devices capable of accessing the Internet for web browsing such as mobile phones.
用户在浏览器侧加载A网站页面http://www.a.com/index.htm,该页面内容的为:The user loads the page of website A http://www.a.com/index.htm on the browser side, and the content of the page is:
<html><html>
<script<script
src="http://www.a.com/jquery-1.7.1.min.js?localFile=abcdabcd.js"></script>src="http://www.a.com/jquery-1.7.1.min.js?localFile=abcdabcd.js"></script>
<font>Helloworld!</font><font>Helloworld!</font>
</html></html>
其中,jquery-1.7.1.min.js为加载A网站所要调用的javascript脚本文件,localFile为其所包含的一特定字段,其值为abcdabcd.js。Among them, jquery-1.7.1.min.js is the javascript script file to be called to load the website A, localFile is a specific field contained in it, and its value is abcdabcd.js.
此时,网页解析模块101接收所述A网站页面对javascript脚本文件jquery-1.7.1.min.js的调用请求。通常,浏览器侧需要从网络服务器侧下载该脚本文件,才能使得所述A网站页面显示出该JS的交互效果。At this time, the webpage parsing module 101 receives the call request of the website A page to the javascript script file jquery-1.7.1.min.js. Usually, the browser side needs to download the script file from the web server side, so that the A website page can display the JS interaction effect.
发明人注意到,这种javascript脚本文件是一种通用的网络资源,内容都是标准的,没有必要让所有首次访问该A网站页面的用户都去下载该脚本文件,一是造成了网络资源的浪费,二是多少会响应浏览器对该网页的响应速度,尤其是在网络状况不太好的情况下。The inventor has noticed that this javascript script file is a common network resource, and its content is standard. It is not necessary for all users who visit the A website page for the first time to download the script file. Waste, the second is how much it will respond to the browser's response speed to the webpage, especially when the network condition is not very good.
根据本发明实施例的文件下载设备,提供文件存储单元104,其中存储有多个内容标准的通用网络资源,诸如jquery-1.7.1.min.js的javascript脚本文件。这样,在利用浏览器加载网页时就可以本地的文件存储单元104中的脚本文件来替代从需要从网络服务器侧下载所述文件,从而提高网络访问速度。According to the file downloading device of the embodiment of the present invention, a file storage unit 104 is provided, in which are stored a plurality of common network resources of content standards, such as javascript script files of jquery-1.7.1.min.js. In this way, when the webpage is loaded by the browser, the script file in the local file storage unit 104 can be used instead of downloading the file from the network server side, thereby increasing the network access speed.
在文件存储单元104中,所存储的脚本文件皆以其特定属性值命名,以使得脚本文件内容能与其文件名唯一、正确地对应。在本实施例中,特定属性值为对文件内容进行哈希计算后的值,更具体地,特定属性值为对文件内容进行md5计算后得到的md5值。In the file storage unit 104, the stored script files are all named after their specific attribute values, so that the contents of the script files can uniquely and correctly correspond to their file names. In this embodiment, the specific attribute value is a value after hash calculation is performed on the file content, more specifically, the specific attribute value is an md5 value obtained after performing md5 calculation on the file content.
可选地,文件存储单元104可以是设置在浏览器安装目录下的存储单元,或者也可以设置在浏览器安装目录的子目录下。Optionally, the file storage unit 104 may be a storage unit set under the browser installation directory, or may also be set under a subdirectory of the browser installation directory.
接下来,文件判断模块102根据所述调用请求来判断所述文件是否存在于文件存储单元104中。在上述对A网站页面的加载中,网页解析模块101接收到的脚本文件调用请求为http://www.a.com/jquery-1.7.1.min.js?localFile=abcdabcd.js。在这种情况下,文件判断模块102将localFile字段值abcdabcd.js与文件存储单元104中所存储的各个文件的文件名进行匹配,由此判断文件存储单元104中是否存在要调用的脚本文件。在本实施例中,若文件存储单元104中的脚本文件名与abcdabcd.js相匹配,则判断其存在有加载A网站网页所需调用的脚本文件jquery-1.7.1.min.js;若不匹配,则判断不存在该脚本文件。Next, the file judging module 102 judges whether the file exists in the file storage unit 104 according to the calling request. In the above loading of the A website page, the script file invocation request received by the web page analysis module 101 is http://www.a.com/jquery-1.7.1.min.js?localFile=abcdabcd.js. In this case, the file judging module 102 matches the localFile field value abcdabcd.js with the file names of the files stored in the file storage unit 104 , thereby judging whether there is a script file to be called in the file storage unit 104 . In the present embodiment, if the script file name in the file storage unit 104 matches abcdabcd.js, then it is judged that there is a script file jquery-1.7.1.min.js that needs to be called to load the A website webpage; if not match, it is judged that the script file does not exist.
当然,若调用请求中不包含特定字段localFile,则文件判断模块102也判断文件存储单元104中不存在所要调用的文件。Of course, if the call request does not include the specific field localFile, the file judging module 102 also judges that the file to be called does not exist in the file storage unit 104 .
在文件存储单元104中存在要调用文件的情况下,浏览器直接从文件存储单元104中获取所述文件并其进行加载,A网站页面即可显示出该JS的交互效果。If there is a file to be called in the file storage unit 104, the browser directly obtains the file from the file storage unit 104 and loads it, and the page of the website A can display the interactive effect of the JS.
在文件存储单元104中不存在要调用文件的情况下,文件下载模块103根据该调用请求从负责提供该文件的服务器下载该文件,然后再由浏览器对该文件进行加载并显示。If there is no file to be called in the file storage unit 104, the file download module 103 downloads the file from the server responsible for providing the file according to the call request, and then the browser loads and displays the file.
更进一步地,本发明的文件下载设备还包括文件名计算模块105,用于计算获得该文件下载模块103下载的文件的特定属性值;在本实施例中,文件名计算模块105通过诸如md5的哈希算法对所下载的文件进行计算,得到其特定属性值。Furthermore, the file downloading device of the present invention also includes a file name calculation module 105, which is used to calculate the specific attribute value of the file downloaded by the file download module 103; in this embodiment, the file name calculation module 105 uses the The hash algorithm calculates the downloaded file to obtain its specific attribute value.
文件下载设备还可以包括文件存储模块106,将文件名计算模块105所计算得到的已下载文件的特定属性值与该调用请求中特定字段localFile的值进行比较,若二者匹配,判断所下载的文件内容未被修改,是标准内容的脚本文件,则在文件存储单元104中存储所下载的文件并以该特定属性值命名;若所计算的特定属性值与所述调用请求包含的特定字段localFile的值不匹配,判断所下载的文件内容已被(恶意地或善意地)修改,不是标准内容的脚本文件,则不存储所下载的文件。The file downloading device can also include a file storage module 106, which compares the specific attribute value of the downloaded file calculated by the file name calculation module 105 with the value of the specific field localFile in the call request, and if the two match, determine the downloaded file. The file content is not modified, it is a script file of standard content, then store the downloaded file in the file storage unit 104 and name it with the specific attribute value; if the calculated specific attribute value is consistent with the specific field localFile value does not match, it is judged that the content of the downloaded file has been modified (maliciously or benignly), and the script file with non-standard content will not store the downloaded file.
在本实施例的描述中,皆以javascript脚本文件为示例,但本领域技术人员都明了,本发明文件下载设备所涉及的文件并不局限于javascript脚本文件,还可以包括其他所有需要从服务器侧调用的文件。In the description of this embodiment, javascript script files are used as an example, but those skilled in the art understand that the files involved in the file download device of the present invention are not limited to javascript script files, and can also include all other files that need to be downloaded from the server side. The file to call.
图2示出了根据本发明另一实施例的文件下载方法的流程示意图,该方法适于在一种文件下载设备中执行。该方法始于步骤201,在步骤S201中,在浏览器侧加载如图1所示实施例的A网站页面时,接收所述A网站页面对javascript脚本文件jquery-1.7.1.min.js的调用请求,可选地,该调用请求还包括特定字段localFile及其值。随后,在步骤202中,根据在步骤S201中所接收的调用请求来判断所请求的文件是否存在于文件下载设备中(例如,在文件下载设备的文件存储单元104中)。Fig. 2 shows a schematic flowchart of a file downloading method according to another embodiment of the present invention, the method is suitable for being executed in a file downloading device. The method begins in step 201, and in step S201, when the browser side loads the A website page of the embodiment shown in Figure 1, the page of the A website to the javascript script file jquery-1.7.1.min.js is received An invocation request, optionally, the invocation request further includes a specific field localFile and its value. Subsequently, in step 202, it is determined whether the requested file exists in the file downloading device (for example, in the file storage unit 104 of the file downloading device) according to the call request received in step S201.
具体地,根据该调用请求是否包文件下载设备中的文件相匹配的文件名来判断是否存在所请求的文件。根据本发明的一个实方式,若该调用请求包含特定字段,且与该特定字段相关联的值与文件下载中的文件的文件名相匹配,则判断存在该文件;若该调用请求所包含的特定字段相关联的值与文件下载设备中的文件的文件名不匹配,或该调用请求不包含该特定字段,则判断不存在所请求的文件。Specifically, it is judged whether the requested file exists according to whether the calling request includes a file name matching the file in the file downloading device. According to an embodiment of the present invention, if the call request contains a specific field, and the value associated with the specific field matches the file name of the file in the file download, it is determined that the file exists; If the value associated with the specific field does not match the file name of the file in the file download device, or the call request does not contain the specific field, then it is determined that the requested file does not exist.
接下来,如果存在有所要调用的脚本文件,则进行步骤203,直接从本地获取该文件并通过浏览器进行加载;Next, if there is a script file to be called, go to step 203, directly obtain the file locally and load it through the browser;
另一方面,如果不存在所要调用的脚本文件,则进行步骤204,根据该调用请求从相应的服务器下载该文件。On the other hand, if there is no script file to be called, go to step 204, and download the file from the corresponding server according to the call request.
在下载文件之后,进入步骤205,获取所下载的文件的特定属性值;在本实施例中,通过诸如md5的哈希算法对所下载的文件进行计算,得到其特定属性值。After downloading the file, go to step 205 to obtain the specific attribute value of the downloaded file; in this embodiment, calculate the downloaded file through a hash algorithm such as md5 to obtain its specific attribute value.
接下来,在步骤206判断该文件的特定属性值与调用请求包含的特定字段的值是否相匹配;Next, in step 206, it is judged whether the specific attribute value of the file matches the value of the specific field included in the call request;
如果匹配,进入步骤207,在本地存储所下载的文件并以该特定属性值命名;If it matches, enter step 207, store the downloaded file locally and name it with the specific attribute value;
如果不匹配,直接进入步骤208结束,不保存所下载的文件。If not, go directly to step 208 and end, without saving the downloaded file.
本发明提供的文件下载设备和相应的文件下载方法,实际提出了一个用本地文件代替网络资源的协议。根据该协议,在本地预置文件存储单元,存储诸如脚本文件的网络资源,将脚本文件以其特定属性值(例如md5值)命名;而网站在其页面内容中对脚本文件进行调用时增加特定字段,例如字段名为localFile,并以该脚本文件的特定属性值(例如md5值)对该字段进行赋值。这样,在浏览器访问使用该协议的网站时,能够直接调用文件存储单元中的脚本文件,减少从所述网站上下载脚本文件从而提高访问的响应速度。The file downloading device and corresponding file downloading method provided by the present invention actually propose a protocol for replacing network resources with local files. According to this agreement, the file storage unit is preset locally to store network resources such as script files, and the script files are named after their specific attribute values (such as md5 values); A field, for example, the field name is localFile, and the field is assigned with a specific attribute value (such as an md5 value) of the script file. In this way, when the browser accesses the website using the protocol, it can directly call the script file in the file storage unit, reducing the downloading of the script file from the website and improving the response speed of the visit.
进一步地,由于本发明文件存储单元所存储的文件皆以其特定属性值(例如md5值)进行命名,通过调用请求中localFile字段的验证,保证了被调用文件的可靠性,使得网站在使用自己的可靠资源的同时,也有机会能够更快地调用来自其他来源的网络资源。Further, since the files stored in the file storage unit of the present invention are all named after their specific attribute values (such as md5 values), the reliability of the called files is guaranteed through the verification of the localFile field in the call request, so that the website uses its own At the same time as the reliable resources of the network, there is also the opportunity to call network resources from other sources more quickly.
B11、如B7-10中任一所述的方法,其中所述特定属性值为对文件内容进行哈希计算后获得的值。B12、如B7-11中任一所述的方法,其中所述文件为javascript脚本文件。B11. The method according to any one of B7-10, wherein the specific attribute value is a value obtained after performing hash calculation on the file content. B12. The method as described in any one of B7-11, wherein the file is a javascript script file.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings), as well as any method or method so disclosed, may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的设备中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the device according to the embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
Claims (6)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310214543.9A CN103258055B (en) | 2013-05-31 | 2013-05-31 | A kind of file download equipment and method |
CN201610237730.2A CN105955980B (en) | 2013-05-31 | 2013-05-31 | File downloading device and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310214543.9A CN103258055B (en) | 2013-05-31 | 2013-05-31 | A kind of file download equipment and method |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610237730.2A Division CN105955980B (en) | 2013-05-31 | 2013-05-31 | File downloading device and method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103258055A CN103258055A (en) | 2013-08-21 |
CN103258055B true CN103258055B (en) | 2016-05-11 |
Family
ID=48961972
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610237730.2A Expired - Fee Related CN105955980B (en) | 2013-05-31 | 2013-05-31 | File downloading device and method |
CN201310214543.9A Active CN103258055B (en) | 2013-05-31 | 2013-05-31 | A kind of file download equipment and method |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610237730.2A Expired - Fee Related CN105955980B (en) | 2013-05-31 | 2013-05-31 | File downloading device and method |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN105955980B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103678535A (en) * | 2013-12-02 | 2014-03-26 | 北京奇虎科技有限公司 | Browser and downloading method thereof |
CN108460053A (en) * | 2017-02-20 | 2018-08-28 | 平安科技(深圳)有限公司 | File memory method and device |
CN107483591A (en) * | 2017-08-22 | 2017-12-15 | 中国银行股份有限公司 | A kind of script file synchronous method and device |
CN112214703B (en) * | 2019-07-10 | 2023-11-07 | 腾讯科技(深圳)有限公司 | Webpage loading method, webpage loading device, computer readable storage medium and computer equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1841369A (en) * | 2005-03-29 | 2006-10-04 | 腾讯科技(深圳)有限公司 | A method for configuring a webpage display page |
CN102567516A (en) * | 2011-12-28 | 2012-07-11 | 华为技术有限公司 | Script loading method and device |
CN102693323A (en) * | 2012-06-06 | 2012-09-26 | 新浪网技术(中国)有限公司 | Cascading style sheet resolving method, resolver, webpage presentation method and server |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101853300B (en) * | 2010-05-26 | 2013-01-30 | 中国科学技术大学 | Method and system for identifying and evaluating video download service websites |
CN101938469A (en) * | 2010-08-08 | 2011-01-05 | 北京大学 | A method and system for transparently loading Android library files at runtime |
US8478943B2 (en) * | 2010-12-28 | 2013-07-02 | Kabushiki Kaisha Toshiba | Content caching device, content caching method, and computer readable medium |
CN102609456A (en) * | 2012-01-12 | 2012-07-25 | 凤凰在线(北京)信息技术有限公司 | System and method for real-time and smart article capturing |
CN102663073B (en) * | 2012-03-31 | 2014-08-20 | 北京奇虎科技有限公司 | Method and system for recommending based on downloaded files |
-
2013
- 2013-05-31 CN CN201610237730.2A patent/CN105955980B/en not_active Expired - Fee Related
- 2013-05-31 CN CN201310214543.9A patent/CN103258055B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1841369A (en) * | 2005-03-29 | 2006-10-04 | 腾讯科技(深圳)有限公司 | A method for configuring a webpage display page |
CN102567516A (en) * | 2011-12-28 | 2012-07-11 | 华为技术有限公司 | Script loading method and device |
CN102693323A (en) * | 2012-06-06 | 2012-09-26 | 新浪网技术(中国)有限公司 | Cascading style sheet resolving method, resolver, webpage presentation method and server |
Non-Patent Citations (2)
Title |
---|
关于缓存是否构成合理使用的研究;芦苇;《万方学位论文全文数据库》;20111229;全文 * |
面向博客领域的垂直搜索引擎的研究与实现;王嘉杰;《中国优秀硕士学位论文全文数据库(电子期刊)》;20100415;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN103258055A (en) | 2013-08-21 |
CN105955980A (en) | 2016-09-21 |
CN105955980B (en) | 2019-12-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103533442B (en) | The loading method and device of video barrage | |
CN103631875B (en) | Method for carrying out network search on browser side and browser | |
CN104063460B (en) | A kind of method and apparatus loading webpage in a browser | |
EP2916243B1 (en) | Method, apparatus, server and system for implementing web application | |
US20190340205A1 (en) | Reducing redirects | |
CN103685528B (en) | Information displaying method and device | |
WO2015127782A1 (en) | Method and system for displaying webpage self-defined content | |
US20100180192A1 (en) | Dynamically configuring a presentation layer associated with a webpage delivered to a client device | |
CN102930037B (en) | page loading method and device | |
CN104504060B (en) | Method, browser client and the device of file are downloaded in browser | |
CN106569856B (en) | A kind of loading method and device of application view resource file | |
CN105022750A (en) | resource file loading method and device | |
WO2018001124A1 (en) | Webpage file sending method, webpage rendering method and apparatus, and webpage rendering system | |
CN102831148B (en) | A browser-based recommended data loading method and device | |
CN103617222A (en) | Browser and method for preloading in webpages | |
CN103631905A (en) | Webpage loading method and browser | |
CN104469528B (en) | A kind of method, apparatus and browser client for carrying out video data loading | |
CN103678508A (en) | Method and device for opening a webpage | |
CN103268319A (en) | A web-based cloud browser | |
CN106202179B (en) | Page loading method and device | |
CN105183890B (en) | Browser-based web page loading method and browser device | |
CN105260421A (en) | Webpage loading method and apparatus | |
CN104462571A (en) | Webpage loading method and device and browser client-side | |
CN103258055B (en) | A kind of file download equipment and method | |
CN104063247B (en) | The call method and system of a kind of application program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20220714 Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015 Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park) Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Patentee before: Qizhi software (Beijing) Co.,Ltd. |