CN105025367A - A page loading method based on digital set-top box - Google Patents
A page loading method based on digital set-top box Download PDFInfo
- Publication number
- CN105025367A CN105025367A CN201410181566.9A CN201410181566A CN105025367A CN 105025367 A CN105025367 A CN 105025367A CN 201410181566 A CN201410181566 A CN 201410181566A CN 105025367 A CN105025367 A CN 105025367A
- Authority
- CN
- China
- Prior art keywords
- page
- loading
- module
- top box
- digital set
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Stored Programmes (AREA)
Abstract
Description
技术领域technical field
本发明涉及页面加载技术领域,尤其涉及一种基于数字机顶盒的页面载入方法。The invention relates to the technical field of page loading, in particular to a page loading method based on a digital set-top box.
背景技术Background technique
随着科技的发展,智能手机、平板电脑等嵌入式设备居于越来越重要的地位,基于智能操作系统的数字机顶盒发展越来越快,尤其是随着数字机顶盒相关软硬件的升级和发展,基于智能操作系统的嵌入式浏览器能够呈现的内容越来越丰富。为了使页面内容更丰富,越来越多的人尝试使用JavaScript框架来编写页面或者开发应用。使用JavaScript框架来编写页面在PC端已经非常流行,而且技术成熟。但是由于数字机顶盒各种软硬件因素的限制,这些使用JavaScript框架所编写的页面在数字机顶盒上运行的效果却并不理想,特别是存在页面载入速度慢的问题。With the development of science and technology, embedded devices such as smartphones and tablet computers are becoming more and more important. Digital set-top boxes based on intelligent operating systems are developing faster and faster, especially with the upgrading and development of related software and hardware of digital set-top boxes. Embedded browsers based on intelligent operating systems can present more and more rich content. In order to make the content of the page richer, more and more people try to use JavaScript frameworks to write pages or develop applications. Using JavaScript frameworks to write pages has become very popular on the PC side, and the technology is mature. However, due to the limitation of various hardware and software factors of the digital set-top box, these pages written using the JavaScript framework do not perform well on the digital set-top box, especially the problem of slow page loading.
发明内容Contents of the invention
本发明的目的在于,为解决现有数字机顶盒的页面载入速度较慢的技术问题,本发明提供一种基于数字机顶盒的页面载入方法,利用该方法让使用JavaScript框架所编写的页面能够流畅的运行在数字机顶盒上,通过对JavaScript框架载入速度的优化,从而提升整个页面在数字机顶盒上的载入速度。The purpose of the present invention is, in order to solve the technical problem that the page loading speed of existing digital set-top box is relatively slow, the present invention provides a kind of page loading method based on digital set-top box, utilize this method to make the page that uses JavaScript framework to write can be smooth runs on the digital set-top box, and optimizes the loading speed of the JavaScript framework to increase the loading speed of the entire page on the digital set-top box.
为实现上述目的,本发明提供了一种基于数字机顶盒的页面载入方法,该方法针对数字机顶盒编写的页面或web应用。所述页面或者web应用都有用到JavaScript框架来编写,所述页面载入方法包括以下几个方面:To achieve the above object, the present invention provides a digital set-top box-based page loading method, which aims at pages or web applications written by the digital set-top box. The page or web application is written using a JavaScript framework, and the page loading method includes the following aspects:
步骤1)将下载到本地的JavaScript框架存入数字机顶盒内;Step 1) deposit the local JavaScript framework downloaded in the digital set-top box;
步骤2)将步骤1)中的JavaScript框架所包含的函数接口按照功能划分为若干个功能模块,其中每个功能模块对应一个.js文件;Step 2) divide the function interface contained in the JavaScript framework in step 1) into several functional modules according to the functions, wherein each functional module corresponds to a .js file;
步骤3)根据数字机顶盒的页面所需编写的功能调用相应的函数接口,进而在所述页面内载入与该函数接口相对应的功能模块。Step 3) calling the corresponding function interface according to the functions to be written on the page of the digital set-top box, and then loading the function module corresponding to the function interface in the page.
作为上述技术方案的进一步改进,所述步骤3)中的功能模块采用异步加载方式载入。As a further improvement of the above technical solution, the functional modules in step 3) are loaded in an asynchronous loading manner.
作为上述技术方案的进一步改进,所述的异步加载方式采用延迟加载或按需加载。As a further improvement of the above technical solution, the asynchronous loading method adopts lazy loading or on-demand loading.
作为上述技术方案的进一步改进,所述步骤2)中的函数接口按照功能划分为:核心方法模块、检测方法模块、事件处理模块、Ajax请求模块、动态效果模块或触控模块。As a further improvement of the above technical solution, the function interface in step 2) is divided into functions according to functions: core method module, detection method module, event processing module, Ajax request module, dynamic effect module or touch module.
针对数字机顶盒的页面中所用的JavaScript框架与一般PC访问的网站页面不同之处在于:所述的JavaScript框架不是通过一个URL地址从远程服务器载入的,而是先把JavaScript框架下载到本地,存放于数字机顶盒的某个目录下(比如user/data),然后在编写页面的时候直接通过从本地目录下(比如user/data)载入所需的JavaScript框架。The difference between the JavaScript frame used in the page for the digital set-top box and the website page accessed by a general PC is that the JavaScript frame is not loaded from a remote server through a URL address, but the JavaScript frame is first downloaded to the local, stored In a certain directory of the digital set-top box (such as user/data), and then directly load the required JavaScript framework from the local directory (such as user/data) when writing the page.
对于下载到本地的JavaScript框架,如果只是在写页面的时候直接载入,会出现只是为了使用JavaScript框架的某一个功能而需要载入整个JavaScript框架,进而造成资源的浪费;特别是当编写一个页面需要用到多个JavaScript框架时,这种资源浪费就更加明显了。由于Javascript框架是一个整体,即为一个.js文件的集合,其包含若干个函数接口,为了避免现有的载入方法所造成的资源浪费,本发明的页面载入方法把下载到本地的JavaScript框架中包含的所有函数接口按照其具体功能归类,划分为多个功能模块,每个模块对应一个.js文件,开发应用时用到某个功能,只需加载这个功能相应功能模块的.js文件,而不需要加载整个javascript框架的.js文件。For the JavaScript framework downloaded to the local, if it is only loaded directly when writing the page, it will appear that the entire JavaScript framework needs to be loaded just to use a certain function of the JavaScript framework, which will cause a waste of resources; especially when writing a page This waste of resources is even more pronounced when multiple JavaScript frameworks are used. Because the Javascript framework is a whole, that is, a collection of .js files, which includes several function interfaces, in order to avoid the waste of resources caused by the existing loading method, the page loading method of the present invention converts the JavaScript file downloaded to the local All the function interfaces contained in the framework are classified according to their specific functions and divided into multiple functional modules, each module corresponds to a .js file, when developing an application to use a certain function, only need to load the .js of the corresponding functional module of this function file instead of the .js file that needs to load the entire javascript framework.
通过把一个JavaScript框架按功能拆分为若干功能模块,然后在写页面的时候只加载相应的功能模块,这样确实能够提高JavaScript框架的载入速度,但是如果同时调用多个功能模块,就会出现同一时间载入多个JavaScript文件的问题,这种并发式的同步加载极可能出现阻塞问题,因此,在上述的页面加载方法上作进一步改进,即在只载入所需功能模块的.js文件的基础上,继续对页面JavaScript框架的载入方式进行优化,采用异步加载方式来载入所需的功能模块,比如延迟加载或者按需加载。By splitting a JavaScript framework into several functional modules according to functions, and then only loading the corresponding functional modules when writing the page, this can indeed improve the loading speed of the JavaScript framework, but if multiple functional modules are called at the same time, there will be The problem of loading multiple JavaScript files at the same time, this concurrent synchronous loading is likely to cause blocking problems, therefore, a further improvement is made on the above page loading method, that is, only the .js files of the required functional modules are loaded On the basis of this, continue to optimize the loading method of the JavaScript framework of the page, and use asynchronous loading to load the required functional modules, such as lazy loading or on-demand loading.
本发明的一种基于数字机顶盒的页面载入方法优点在于:A kind of page loading method based on digital set-top box of the present invention has the advantages of:
通过把JavaScript框架下载到本地,然后把下载到本地的JavaScript框架划分为若干功能模块,在需要用到某个模块的接口时,采用按需加载或延迟加载的方式载入所需的功能模块,能够充分利用网络带宽资源,减小页面载入JavaScript框架文件的大小,从而提升页面载入速度。By downloading the JavaScript framework to the local, and then dividing the downloaded JavaScript framework into several functional modules, when the interface of a certain module is needed, the required functional modules are loaded by means of on-demand loading or delayed loading, It can make full use of network bandwidth resources and reduce the size of the JavaScript framework file loaded on the page, thereby improving the page loading speed.
附图说明Description of drawings
图1为本发明实施例中的一种基于数字机顶盒的页面载入方法流程图。FIG. 1 is a flowchart of a page loading method based on a digital set-top box in an embodiment of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本发明所述的一种基于数字机顶盒的页面载入方法进行详细说明。A page loading method based on a digital set-top box according to the present invention will be described in detail below with reference to the drawings and embodiments.
本发明的基于数字机顶盒的页面载入方法应用于数字机顶盒所编写的页面或web应用。该页面载入方法包括以下步骤:The page loading method based on the digital set-top box of the present invention is applied to pages or web applications written by the digital set-top box. The page loading method includes the following steps:
步骤1)将下载到本地的JavaScript框架存入数字机顶盒内;Step 1) deposit the local JavaScript framework downloaded in the digital set-top box;
步骤2)将步骤1)中的JavaScript框架所包含的函数接口按照功能划分为若干个功能模块,其中每个功能模块对应一个.js文件;Step 2) divide the function interface contained in the JavaScript framework in step 1) into several functional modules according to the functions, wherein each functional module corresponds to a .js file;
步骤3)根据数字机顶盒的页面所需编写的功能调用相应的函数接口,进而在所述页面内载入与该函数接口相对应的功能模块。Step 3) calling the corresponding function interface according to the functions to be written on the page of the digital set-top box, and then loading the function module corresponding to the function interface in the page.
基于上述页面载入方法,如图1所示,在本实施例中以zepto.js文件作为载入的JavaScript框架为例进一步说明。具体操作步骤如下:Based on the above page loading method, as shown in FIG. 1 , in this embodiment, the zepto.js file is used as an example for further description. The specific operation steps are as follows:
步骤101)把编写页面或者web应用所需的JavaScript框架下载到本地,存放于数字机顶盒的某个位置。Step 101) Download the JavaScript framework required for writing the page or web application to the local, and store it in a certain location of the digital set-top box.
具体地,下载zepto.js文件到本地,目前zepto的最新版本是1.0版本;并将下载的zepto.js文件存放于数字机顶盒usr/data目录下。Specifically, download the zepto.js file to the local, and the latest version of zepto is version 1.0; and store the downloaded zepto.js file in the usr/data directory of the digital set-top box.
步骤102)将下载到本地的JavaScript框架按功能划分为若干功能模块。Step 102) Divide the JavaScript framework downloaded locally into several functional modules according to functions.
具体地,将步骤101)中下载到本地的zepto.js文件按照各函数接口的功能归类,可分别划分为:核心方法模块、检测方法模块、事件处理模块、Ajax请求模块、动态效果模块或触控模块,上述每个模块分别对应一个.js文件。在本实施例中,上述的核心方法模块是在编写页面时使用最多的函数接口的集合,比如对DOM元素的读取以及操作的函数接口都可以归类为此模块;所述的检测方法模块的功能主要是检测设备类型、设备所用操作系统、浏览器的版本、设备平台类型以及拆分到此模块中函数接口的类别;所述的事件处理模块的功能就是处理事件,可将具有添加事件、删除时间、监听事件以及触发事件功能的函数接口划分到此模块中;所述Ajax请求模块主要功能就是处理Ajax请求,可将具有查询Ajax请求、执行Ajax请求以及返回Ajax请求功能的函数接口划分到此模块中;动态效果模块主要功能是处理页面中和动画有关的内容,可将具有设置动画显示时间、旋转角度、动画完成后执行的动作功能的函数接口划分到此模块中;触控模块主要针对有触摸屏的设备,可将具有定义单击或者滑动动作含义的功能的函数接口划分到此模块中。Specifically, the zepto.js file downloaded to the local in step 101) is classified according to the function of each function interface, and can be divided into: core method module, detection method module, event processing module, Ajax request module, dynamic effect module or Touch module, each of the above modules corresponds to a .js file. In this embodiment, the above-mentioned core method module is a collection of the most used function interfaces when writing pages, such as the function interfaces for reading and operating DOM elements can be classified as this module; the detection method module The function is mainly to detect the type of device, the operating system used by the device, the version of the browser, the type of the device platform, and the category of the function interface split into this module; the function of the event processing module is to process events, which can add events , delete time, monitor events and trigger event function function interfaces are divided into this module; the main function of the Ajax request module is to process Ajax requests, and can divide the function interfaces with the functions of querying Ajax requests, executing Ajax requests and returning Ajax requests Go to this module; the main function of the dynamic effect module is to process the content related to the animation in the page, and the function interface with the function of setting the animation display time, rotation angle, and action function after the animation is completed can be divided into this module; the touch module Mainly for devices with a touch screen, the function interface with the function of defining the meaning of the click or slide action can be divided into this module.
步骤103)当编写页面或者web应用时,根据需求只加载所需要的功能模块。Step 103) When writing a page or web application, only the required functional modules are loaded according to requirements.
具体地,在编写页面或者web应用时,如果需要调用触摸相关的函数接口,那就需要加载触控与该函数接口对应的功能模块的.js文件。Specifically, when writing a page or web application, if a touch-related function interface needs to be invoked, the .js file of the touch function module corresponding to the function interface needs to be loaded.
步骤104)如果需要同时调用多个函数接口,而这些函数接口在不同的功能模块中,那就需要加载多个功能模块,此时可采用延时加载或者按需加载的方式。Step 104) If multiple function interfaces need to be called at the same time, and these function interfaces are in different function modules, then multiple function modules need to be loaded. At this time, a delayed loading or on-demand loading method can be used.
具体地,如果出现有多个功能模块需要加载的情况,为了防止出现同步加载多个.js文件可能出现的阻塞问题,可以采用以下方法来加载多个功能模块:Specifically, if there are multiple functional modules that need to be loaded, in order to prevent possible blocking problems that may occur when loading multiple .js files synchronously, the following methods can be used to load multiple functional modules:
1、直接采用<script src="xx.js"/>的方法加载多个功能模块,但是不把所有功能模块的js文件都放在页面代码中<body>标签之前,而是把部分核心功能的功能模块放在<body>标签之前加载,而一些不是必须要一开始就加载的模块,比如具有动态效果的功能模块,则放在<body>标签之后,待优先加载的功能模块加载完之后再进行加载1. Directly use the <script src="xx.js"/> method to load multiple functional modules, but do not put the js files of all functional modules before the <body> tag in the page code, but put some core functions The functional modules are loaded before the <body> tag, and some modules that do not have to be loaded at the beginning, such as functional modules with dynamic effects, are placed after the <body> tag, after the priority loaded functional modules are loaded load again
2、可以采用延时加载的方式载入所需的功能模块。通过设置各个模块延迟加载时间来避免出现同步加载多个js文件可能出现的阻塞问题。2. The required functional modules can be loaded in the way of delayed loading. By setting the delay loading time of each module to avoid the blocking problem that may occur when loading multiple js files synchronously.
加载功能模块的部分代码如下:Part of the code for loading the function module is as follows:
延时加载的部分代码如下:Part of the code for delayed loading is as follows:
3、还可以采用按需加载的方式载入所需功能模块,按需加载就是按页面中某个功能需要调用JavaScript框架中的相应功能模块,当编写页面时设置这个功能的触发事件;此时,当该事件被触发后通过回调函数加载该功能需要的功能模块,加载完该功能模块后执行相应的功能。3. You can also load the required functional modules in the way of on-demand loading. On-demand loading is to call the corresponding functional modules in the JavaScript framework according to a certain function in the page, and set the trigger event of this function when writing the page; at this time , when the event is triggered, the function module required by the function is loaded through the callback function, and the corresponding function is executed after the function module is loaded.
最后所应说明的是,以上实施例仅用以说明本发明的技术方案而非限制。尽管参照实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,对本发明的技术方案进行修改或者等同替换,都不脱离本发明技术方案的精神和范围,其均应涵盖在本发明的权利要求范围当中。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than limit them. Although the present invention has been described in detail with reference to the embodiments, those skilled in the art should understand that modifications or equivalent replacements to the technical solutions of the present invention do not depart from the spirit and scope of the technical solutions of the present invention, and all of them should be included in the scope of the present invention. within the scope of the claims.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410181566.9A CN105025367A (en) | 2014-04-30 | 2014-04-30 | A page loading method based on digital set-top box |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410181566.9A CN105025367A (en) | 2014-04-30 | 2014-04-30 | A page loading method based on digital set-top box |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105025367A true CN105025367A (en) | 2015-11-04 |
Family
ID=54415013
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410181566.9A Pending CN105025367A (en) | 2014-04-30 | 2014-04-30 | A page loading method based on digital set-top box |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105025367A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106570071A (en) * | 2016-10-14 | 2017-04-19 | 上海斐讯数据通信技术有限公司 | Method and system for loading front end page of cloud access controller |
CN107665124A (en) * | 2017-09-14 | 2018-02-06 | 广东神马搜索科技有限公司 | Modularization JavaScript file processing method, equipment and server |
CN108197024A (en) * | 2017-12-28 | 2018-06-22 | 深圳Tcl数字技术有限公司 | Built-in browser adjustment method, debugging terminal and computer readable storage medium |
CN109343908A (en) * | 2018-10-19 | 2019-02-15 | 网宿科技股份有限公司 | A method and device for delay loading JS script |
CN109658250A (en) * | 2018-12-29 | 2019-04-19 | 深圳源中瑞科技有限公司 | A kind of web-based stock exchange K line processing method and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101131747A (en) * | 2006-08-22 | 2008-02-27 | 国际商业机器公司 | Method, device and system for catching and/or analyzing Web page events at client terminal |
CN101600089A (en) * | 2009-06-16 | 2009-12-09 | 中兴通讯股份有限公司 | The implementation method of the advertising business in the network television system and device |
CN102316384A (en) * | 2011-09-08 | 2012-01-11 | 中兴通讯股份有限公司 | Page multigraph switching realization method and embedded browser of interactive personality TV (IPTV) |
US8429180B1 (en) * | 2008-03-31 | 2013-04-23 | Symantec Corporation | Cooperative identification of malicious remote objects |
CN103440151A (en) * | 2013-09-05 | 2013-12-11 | 北京京东尚科信息技术有限公司 | Method and apparatus for dynamically loading Web page |
-
2014
- 2014-04-30 CN CN201410181566.9A patent/CN105025367A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101131747A (en) * | 2006-08-22 | 2008-02-27 | 国际商业机器公司 | Method, device and system for catching and/or analyzing Web page events at client terminal |
US8429180B1 (en) * | 2008-03-31 | 2013-04-23 | Symantec Corporation | Cooperative identification of malicious remote objects |
CN101600089A (en) * | 2009-06-16 | 2009-12-09 | 中兴通讯股份有限公司 | The implementation method of the advertising business in the network television system and device |
CN102316384A (en) * | 2011-09-08 | 2012-01-11 | 中兴通讯股份有限公司 | Page multigraph switching realization method and embedded browser of interactive personality TV (IPTV) |
CN103440151A (en) * | 2013-09-05 | 2013-12-11 | 北京京东尚科信息技术有限公司 | Method and apparatus for dynamically loading Web page |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106570071A (en) * | 2016-10-14 | 2017-04-19 | 上海斐讯数据通信技术有限公司 | Method and system for loading front end page of cloud access controller |
CN107665124A (en) * | 2017-09-14 | 2018-02-06 | 广东神马搜索科技有限公司 | Modularization JavaScript file processing method, equipment and server |
CN108197024A (en) * | 2017-12-28 | 2018-06-22 | 深圳Tcl数字技术有限公司 | Built-in browser adjustment method, debugging terminal and computer readable storage medium |
CN108197024B (en) * | 2017-12-28 | 2022-01-04 | 深圳Tcl数字技术有限公司 | Embedded browser debugging method, debugging terminal and computer readable storage medium |
CN109343908A (en) * | 2018-10-19 | 2019-02-15 | 网宿科技股份有限公司 | A method and device for delay loading JS script |
CN109343908B (en) * | 2018-10-19 | 2020-12-29 | 网宿科技股份有限公司 | A method and device for delay loading JS script |
CN109658250A (en) * | 2018-12-29 | 2019-04-19 | 深圳源中瑞科技有限公司 | A kind of web-based stock exchange K line processing method and storage medium |
CN109658250B (en) * | 2018-12-29 | 2021-11-12 | 深圳源中瑞科技有限公司 | Stock transaction K-line processing method based on webpage and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11647096B2 (en) | Method and apparatus for automatically optimizing the loading of images in a cloud-based proxy service | |
JP6488508B2 (en) | Web page access method, apparatus, device, and program | |
US8386955B1 (en) | User-optimized content for web browsing windows | |
CN104951326B (en) | Webpage access method and device | |
US9342616B2 (en) | User influenced asynchronous module definition loader | |
US20130151937A1 (en) | Selective image loading in mobile browsers | |
TW201443670A (en) | Virtual library providing content accessibility irrespective of content format and type | |
WO2014186489A2 (en) | Enhanced links in curation and collaboration applications | |
US9690757B2 (en) | Method of and system for processing content of a web resource in a browser application | |
CN103034518B (en) | The method and browser of loading browser control instrument | |
WO2016107325A1 (en) | Page resource loading method and device based on mobile terminal | |
US9178746B2 (en) | Browser-based fetch of external libraries | |
CN103530160A (en) | Page loading method and device | |
CN105025367A (en) | A page loading method based on digital set-top box | |
CN113343312B (en) | Page tamper-proof method and system based on front-end embedded point technology | |
CN107590228A (en) | A kind of page content processing method and mobile terminal | |
CN105630310A (en) | Method and device for displaying titles during graph group switching | |
US8856216B2 (en) | Method and apparatus for efficiently performing file services using cloud computing | |
US9436669B1 (en) | Systems and methods for interfacing with dynamic web forms | |
CN113553522B (en) | A page display method, device, electronic device and storage medium | |
US20140143649A1 (en) | Dynamic File Retrieving for Web Page Loading | |
CN113449216A (en) | File processing method and device and storage medium | |
US20150089559A1 (en) | Method and system for managing display of web-based content on portable communication devices | |
CN110727889A (en) | Static webpage resource loading method, device, medium and electronic equipment | |
CN113761415B (en) | Page display method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20151104 |
|
RJ01 | Rejection of invention patent application after publication |