CN104850602B - A kind of rendering refreshing implementation method and device based on internet web page - Google Patents
A kind of rendering refreshing implementation method and device based on internet web page Download PDFInfo
- Publication number
- CN104850602B CN104850602B CN201510220673.2A CN201510220673A CN104850602B CN 104850602 B CN104850602 B CN 104850602B CN 201510220673 A CN201510220673 A CN 201510220673A CN 104850602 B CN104850602 B CN 104850602B
- Authority
- CN
- China
- Prior art keywords
- page
- address
- url address
- current browser
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000009877 rendering Methods 0.000 title claims abstract description 25
- 230000008859 change Effects 0.000 claims description 6
- 230000004048 modification Effects 0.000 claims description 6
- 238000012986 modification Methods 0.000 claims description 6
- 238000005538 encapsulation Methods 0.000 claims description 3
- 230000006870 function Effects 0.000 abstract description 17
- 238000012546 transfer Methods 0.000 description 13
- 238000010586 diagram Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000009191 jumping Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
本发明实施例提供一种基于互联网网页的渲染刷新实现方法及装置,所述方法包括:当一客户端的某一网页对应的整个页面中的一个或多个页面模块刷新时,获取所述一个或多个页面模块的刷新数据;将所述一个或多个页面模块的刷新数据渲染到所述网页对应的整个页面中,替换原来所述一个或多个页面模块的原数据,并将所述网页对应的当前浏览器的URL地址修改为新的URL地址。本发明实现了在不刷新页面的情况下,动态改变浏览器的地址栏URL,方便网站内容分享;完美兼容各种浏览器记录,实现动态改变浏览器地址,不刷新页面实现功能页面切换;通过pagelets刷新进行一次服务器请求实现页面功能增量切换,减少服务器连接数;在同域页面浏览历史记录最小化,减少冗余历史记录。
Embodiments of the present invention provide a method and device for implementing rendering refresh based on Internet webpages. The method includes: when one or more page modules in the entire page corresponding to a certain webpage of a client are refreshed, obtaining the one or more page modules Refresh data of multiple page modules; render the refresh data of the one or more page modules into the entire page corresponding to the webpage, replace the original data of the one or more page modules, and render the webpage The URL address of the corresponding current browser is changed to a new URL address. The present invention realizes dynamically changing the address bar URL of the browser without refreshing the page, which facilitates website content sharing; is perfectly compatible with various browser records, realizes dynamically changing the browser address, and realizes functional page switching without refreshing the page; through Pagelets refreshes a server request to implement incremental switching of page functions, reducing the number of server connections; minimizing the browsing history of pages in the same domain, reducing redundant historical records.
Description
技术领域technical field
本发明涉及互联网技术领域,尤其涉及一种基于互联网网页的渲染刷新实现方法及装置。The present invention relates to the technical field of the Internet, in particular to a method and device for realizing rendering refresh based on Internet web pages.
背景技术Background technique
随着互联网在国内的日新月异的发展,web应用(浏览器网站应用)在internet(互联网)上广泛使用。用户每浏览一次网页都会生成一次历史记录,用户可以在历史记录中查看每次浏览的历史记录。With the rapid development of the Internet in China, web applications (browser website applications) are widely used on the Internet (Internet). Every time a user browses a web page, a history record is generated, and the user can view the history record of each browsing in the history record.
现有技术web 1.0应用通过超链接实现页面跳转并生成历史记录,每次页面跳转都会产生记录,可以在历史记录中自由切换回到历史访问的网站页面。但每次页面之间切换都会刷新整个页面,并在历史记录中生成一条历史记录,不管是否在同一网站不同模块之间切换,导致在历史记录中有多个同一网站大量的历史记录。In the prior art, web 1.0 applications implement page jumps through hyperlinks and generate history records, each page jump will generate a record, and you can freely switch back to historically visited website pages in the history records. But every time you switch between pages, the entire page will be refreshed, and a history record will be generated in the history record, regardless of whether you switch between different modules of the same website, resulting in multiple history records of the same website in the history record.
随着AJAX(AJAX:Asynchronous Javascript And XML异步JavaScript(脚本)和XML(Extensible Markup Language可扩展标记语言),是指一种创建交互式网页应用的网页开发技术)技术在web开发广泛使用,通过XHR(ajax异步请求对象)请求后台数据,javascript(脚本)解析数据并转换成html(超文本标记语言,Hyper Text MarkupLanguage)节点渲染文档流。从而实现从服务器获取相关数据局部模块刷新,优化用户交互体验。浏览器不会生成浏览记录,刷新模块或者页面刷新时会产生大量并发请求http(超文本传输协议,HyperText Transfer Protocol)请求,导致服务器压力过大。With AJAX (AJAX: Asynchronous Javascript And XML asynchronous JavaScript (script) and XML (Extensible Markup Language), which refers to a web development technology for creating interactive web applications) technology is widely used in web development, through XHR (ajax asynchronous request object) requests background data, javascript (script) parses the data and converts it into html (Hyper Text Markup Language, Hyper Text Markup Language) node rendering document stream. In this way, partial module refresh of relevant data obtained from the server is realized, and user interaction experience is optimized. The browser will not generate browsing records, and a large number of concurrent HTTP (HyperText Transfer Protocol) requests will be generated when the module is refreshed or the page is refreshed, resulting in excessive pressure on the server.
现有技术web1.0技术缺点:用户访问同一个web站点(网站),网站地址为http://weibo.com/a.com(网站地址),在网站功能页面切换。通过超链接跳转将生成多个weibo.com(域名)的历史记录,历史记录将随着访问次数线性增长。历史记录冗余,不方便管理,占用用户磁盘空间,而且整页刷新页面,用户体验不好。Technical disadvantage of web1.0 in the prior art: the user visits the same web site (website), the website address is http://weibo.com/a.com (website address), and switches on the website function page. Jumping through hyperlinks will generate multiple history records of weibo.com (domain name), and the history records will grow linearly with the number of visits. The history records are redundant, inconvenient to manage, occupying the user's disk space, and the entire page is refreshed, which is not a good user experience.
AJAX没有完美解决历史记录方案,无法按照需要配置刷新模块,而且服务器瞬间请求压力较大。用户交互体验一般。AJAX does not have a perfect solution to the history record solution, and the refresh module cannot be configured as required, and the server is under a lot of request pressure instantly. The user interaction experience is average.
bigbipe(页面按模块加载):是一个重新设计的基础动态网页服务体系。网页按模块功能分解成Pagelets(单个模块)块,然后通过Web服务器(网络环境下为客户提供服务的专用计算机)和浏览器建立管道并管理他们在不同阶段的运行。这是类似于大多数现代微处理器的流水线执行过程:多重指令管线通过不同的处理器执行单元,以达到性能的最佳。bigbipe (page loaded by module): It is a redesigned basic dynamic web service system. Web pages are decomposed into Pagelets (single module) blocks according to module functions, and then establish pipelines and manage their operations in different stages through Web servers (dedicated computers that provide services to customers in a network environment) and browsers. This is similar to the pipelined execution process of most modern microprocessors: multiple instruction pipelines pass through different processor execution units to achieve the best performance.
Pagelets(单个模块):一个模块称为一个pagelets模块。模块通过框架提供的注册方法将模块注册进内存并执行。框架提供方法(注册)register(ns(参数):模块标示,domid(参数):容器标示,html(参数):模块渲染字符串,js(参数):脚本地址,css(参数):样式地址),来完成模块的样式加载、页面渲染、执行脚本的步骤。每个模块提供destroy(销毁方法),便于在切换页面时,框架将不使用的模块销毁,释放占用的内存。Pagelets (single module): A module is called a pagelets module. The module registers the module into the memory and executes it through the registration method provided by the framework. Framework providing method (registration) register(ns(parameter): module label, domid(parameter): container label, html(parameter): module rendering string, js(parameter): script address, css(parameter): style address) , to complete the steps of module style loading, page rendering, and script execution. Each module provides destroy (destroy method), so that when switching pages, the framework destroys unused modules and releases the occupied memory.
微博采用bigpipe按模块按需输出,只要模块加载完成后,就可以与其交互,模块间不耦合。Weibo uses bigpipe to output modules on demand, as long as the module is loaded, it can interact with it, and there is no coupling between modules.
分块传输编码(Chunked transfer encoding):是超文本传输协议(HTTP)中的一种数据传输机制,允许HTTP由网页服务器发送给客户端应用(通常是网页浏览器)的数据可以分成多个部分。分块传输编码只在HTTP协议(超文本传输协议)1.1版本(HTTP/1.1)(超文本传输协议1.1版本)中提供。Chunked transfer encoding (Chunked transfer encoding): It is a data transmission mechanism in the Hypertext Transfer Protocol (HTTP), which allows HTTP data sent by a web server to a client application (usually a web browser) to be divided into multiple parts . Chunked transfer encoding is only provided in the HTTP protocol (Hypertext Transfer Protocol) version 1.1 (HTTP/1.1) (Hypertext Transfer Protocol version 1.1).
通常,HTTP(超文本传输协议)应答消息中发送的数据是整个发送的,Content-Length(内容长度)消息头字段表示数据的长度。数据的长度很重要,因为客户端需要知道哪里是应答消息的结束,以及后续应答消息的开始。然而,使用分块传输编码,数据分解成一系列数据块,并以一个或多个块发送,这样服务器可以发送数据而不需要预先知道发送内容的总大小。Usually, the data sent in the HTTP (Hypertext Transfer Protocol) response message is sent in its entirety, and the Content-Length (content length) message header field indicates the length of the data. The length of the data is important because the client needs to know where the reply message ends and the subsequent reply message begins. However, with chunked transfer encoding, the data is broken up into a series of data chunks and sent in one or more chunks, so that the server can send the data without knowing in advance the total size of what is being sent.
Pagelets(模块)刷新:页面切换一次刷新,输出改变内容的Pagelets模块,改变需要Pagelets对应的模块,实现页面模块无刷新切换。Pagelets (module) refresh: page switching is refreshed once, the Pagelets module that changes the content is output, and the module corresponding to the Pagelets is changed, so that the page module can be switched without refreshing.
bigbipe(页面按模块加载)技术实现多模块并行和可控输出,增加模块的可复用率。模块之间不耦合,模块之间不相互依赖,模块可以独立运行,模块可以并发随机加载。只要Pagelets(单个模块)输出完成立即渲染,模块立即使用交互,不管其他模块是否加载完成。实现模块并行加载,优化模块加载顺序,模块按流水线方式加载使用,优化用户体验。Bigbipe (page loaded by module) technology realizes multi-module parallel and controllable output, increasing the reusability of modules. There is no coupling between modules, no interdependence between modules, modules can run independently, and modules can be loaded concurrently and randomly. As soon as the Pagelets (single module) output is rendered immediately, the module uses interactions immediately, regardless of whether other modules have loaded or not. Realize parallel loading of modules, optimize the loading sequence of modules, load and use modules in a pipelined manner, and optimize user experience.
现有技术将整个页面按功能分模块,模块之间相互不依赖。页面切换时,只是通过算法chunked(分块传输)输出需要修改的模块替换原来模块,而公共模块则不更新修改,从而达到页面切换的功能。Chunked输出(分块传输)修改只一次http请求(超文本传输协议HyperText Transfer Protocol)完成页面功能切换。由于页面没有刷新,地址栏不会修改,如何实现无刷新并修改页面URL地址?例如:从http://weibo.com/a.html(网站地址)跳转到http://weibo.com/b.html(网站地址),现有技术的方式为刷新整个页面,通过链接跳转到http://weibo.com/b.html(网站地址)。这样顶部导航、左侧导航、底部模块都会重新请求刷新,由此造成网络传输数据增大,网络带宽增加,服务器负荷增大,因此,如何实现无刷新并修改页面URL地址,这是本领域的技术人员亟待解决的一个技术问题。The existing technology divides the entire page into modules according to functions, and the modules do not depend on each other. When the page is switched, only the module that needs to be modified is output through the algorithm chunked (block transmission) to replace the original module, while the public module is not updated and modified, so as to achieve the function of page switching. Chunked output (chunked transfer) modification requires only one http request (HyperText Transfer Protocol) to complete page function switching. Since the page is not refreshed, the address bar will not be modified, how to achieve no refresh and modify the page URL address? For example: jumping from http://weibo.com/a.html (website address) to http://weibo.com/b.html (website address), the way of the prior art is to refresh the entire page and jump through the link Go to http://weibo.com/b.html (website address). In this way, the top navigation, the left navigation, and the bottom module will all request refresh again, which will increase the network transmission data, increase the network bandwidth, and increase the server load. Therefore, how to realize no refresh and modify the page URL address is an issue in this field. A technical problem urgently needed to be solved by technicians.
发明内容Contents of the invention
本发明实施例提供一种基于互联网网页的渲染刷新实现方法及装置,以实现无刷新并修改页面URL地址。Embodiments of the present invention provide a method and device for implementing rendering refresh based on Internet web pages, so as to realize no refresh and modify the URL address of the page.
一方面,本发明实施例提供了一种基于互联网网页的渲染刷新实现方法,所述方法包括:On the one hand, an embodiment of the present invention provides a method for implementing rendering refresh based on Internet web pages, the method comprising:
当一客户端的某一网页对应的整个页面中的一个或多个页面模块刷新时,获取所述一个或多个页面模块的刷新数据;When one or more page modules in the entire page corresponding to a certain webpage of a client are refreshed, obtain refresh data of the one or more page modules;
将所述一个或多个页面模块的刷新数据渲染到所述网页对应的整个页面中,替换原来所述一个或多个页面模块的原数据,并将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址。Render the refresh data of the one or more page modules into the entire page corresponding to the web page, replace the original data of the one or more page modules, and transfer the unified resources of the current browser corresponding to the web page The locator URL address is changed to a new URL address.
另一方面,本发明实施例提供了一种基于互联网网页的渲染刷新实现装置,所述装置包括:On the other hand, an embodiment of the present invention provides an Internet webpage-based rendering refresh implementation device, the device comprising:
获取单元,用于当一客户端的某一网页对应的整个页面中的一个或多个页面模块刷新时,获取所述一个或多个页面模块的刷新数据;An acquisition unit, configured to acquire refresh data of the one or more page modules when one or more page modules in the entire page corresponding to a certain webpage of a client are refreshed;
渲染刷新单元,用于将所述一个或多个页面模块的刷新数据渲染到所述网页对应的整个页面中,替换原来所述一个或多个页面模块的原数据;a rendering and refreshing unit, configured to render the refresh data of the one or more page modules into the entire page corresponding to the web page, and replace the original data of the one or more page modules;
地址修改单元,用于将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址。The address modifying unit is configured to modify the URL address of the current browser corresponding to the web page to a new URL address.
上述技术方案具有如下有益效果:实现了在不刷新页面的情况下,动态改变浏览器的地址栏URL,方便网站内容分享;完美兼容各种浏览器记录,实现动态改变浏览器地址,不刷新页面实现功能页面切换;通过pagelets刷新进行一次服务器请求实现页面功能增量切换,减少服务器连接数;在同域页面浏览历史记录最小化,减少冗余历史记录。The above-mentioned technical solution has the following beneficial effects: the URL in the address bar of the browser can be dynamically changed without refreshing the page, which is convenient for website content sharing; it is perfectly compatible with various browser records, and the browser address can be dynamically changed without refreshing the page Realize functional page switching; perform a server request through pagelets refresh to realize incremental switching of page functions, reduce the number of server connections; minimize the browsing history of pages in the same domain, and reduce redundant historical records.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明实施例一种基于互联网网页的渲染刷新实现方法流程图;FIG. 1 is a flow chart of a method for implementing rendering refresh based on Internet webpages according to an embodiment of the present invention;
图2为本发明实施例一种基于互联网网页的渲染刷新实现装置结构示意图;FIG. 2 is a schematic structural diagram of a device for realizing rendering and refreshing based on Internet webpages according to an embodiment of the present invention;
图3为本发明应用实例模块E和模块F刷新示意图;Fig. 3 is a schematic diagram of updating module E and module F of the application example of the present invention;
图4为本发明应用实例一种基于互联网网页的渲染刷新实现方法流程图。FIG. 4 is a flow chart of an implementation method for rendering and refreshing based on Internet webpages in an application example of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
如图1所示,为本发明实施例一种基于互联网网页的渲染刷新实现方法流程图,所述方法包括:As shown in FIG. 1 , it is a flow chart of a method for implementing rendering refresh based on Internet web pages according to an embodiment of the present invention, and the method includes:
101、当一客户端的某一网页对应的整个页面中的一个或多个页面模块刷新时,获取所述一个或多个页面模块的刷新数据;101. When one or more page modules in the entire page corresponding to a certain webpage of a client are refreshed, obtain refresh data of the one or more page modules;
102、将所述一个或多个页面模块的刷新数据渲染到所述网页对应的整个页面中,替换原来所述一个或多个页面模块的原数据,并将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址。102. Render the refresh data of the one or more page modules into the entire page corresponding to the web page, replace the original data of the one or more page modules, and update the current browser's corresponding to the web page The Uniform Resource Locator URL address is changed to a new URL address.
优选的,所述将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址,包括:通过封装页面浏览历史记录管理类historyM将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址。Preferably, said modifying the Uniform Resource Locator URL address of the current browser corresponding to the web page to a new URL address includes: unifying the URL address of the current browser corresponding to the web page by encapsulating the page browsing history management class historyM The URL address of the resource locator is changed to a new URL address.
优选的,所述通过封装页面浏览历史记录管理类historyM将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址,包括:判断当前浏览器是否支持封装页面浏览历史记录管理类historyM中的替换地址replaceState/操作地址栏地址方法pushState:若所述当前浏览器支持replaceState/pushState,则使用replaceState/pushState将所述网页对应的当前浏览器的URL地址修改为新的URL地址。Preferably, modifying the URL address of the current browser corresponding to the web page to a new URL address by encapsulating the page browsing history management class historyM includes: judging whether the current browser supports encapsulating page browsing history The replacement address in the management class historyM replaceState/operation address bar address method pushState: If the current browser supports replaceState/pushState, use replaceState/pushState to modify the URL address of the current browser corresponding to the web page to a new URL address .
优选的,所述方法还包括:若所述当前浏览器不支持replaceState/pushState,则判断当前浏览器是否支持浏览器哈希改变事件onhashChange事件:若所述当前浏览器支持onhashChange事件,则通过修改location.hash(本地哈希)地址来将所述网页对应的当前浏览器的URL地址动态修改为新的URL地址。Preferably, the method further includes: if the current browser does not support replaceState/pushState, then judging whether the current browser supports the browser hash change event onhashChange event: if the current browser supports the onhashChange event, then by modifying location.hash (local hash) address to dynamically modify the URL address of the current browser corresponding to the webpage to a new URL address.
优选的,所述方法还包括:若所述当前浏览器不支持onhashChange事件,则通过动态创建浏览器标签iframe插入文档流方式,将所述网页对应的当前浏览器的URL地址动态修改为新的URL地址。Preferably, the method further includes: if the current browser does not support the onhashChange event, dynamically modifying the URL address of the current browser corresponding to the web page to a new URL address.
对应于上述方法实施例,如图2所示,为本发明实施例一种基于互联网网页的渲染刷新实现装置结构示意图,所述装置包括:Corresponding to the above-mentioned method embodiment, as shown in FIG. 2 , it is a schematic structural diagram of an Internet webpage-based rendering refresh implementation device according to an embodiment of the present invention. The device includes:
获取单元21,用于当一客户端的某一网页对应的整个页面中的一个或多个页面模块刷新时,获取所述一个或多个页面模块的刷新数据;The acquiring unit 21 is configured to acquire refresh data of the one or more page modules when one or more page modules in the entire page corresponding to a certain web page of a client are refreshed;
渲染刷新单元22,用于将所述一个或多个页面模块的刷新数据渲染到所述网页对应的整个页面中,替换原来所述一个或多个页面模块的原数据;A rendering and refreshing unit 22, configured to render the refresh data of the one or more page modules into the entire page corresponding to the web page, and replace the original data of the one or more page modules;
地址修改单元23,用于将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址。The address modifying unit 23 is configured to modify the URL address of the current browser corresponding to the web page to a new URL address.
优选的,所述地址修改单元23,具体用于通过封装页面浏览历史记录管理类historyM将所述网页对应的当前浏览器的统一资源定位符URL地址修改为新的URL地址。Preferably, the address modifying unit 23 is specifically configured to modify the URL address of the current browser corresponding to the web page to a new URL address by encapsulating the page browsing history record management class historyM.
优选的,所述地址修改单元23,进一步具体用于判断当前浏览器是否支持封装页面浏览历史记录管理类historyM中的替换地址replaceState/操作地址栏地址方法pushState:若所述当前浏览器支持replaceState/pushState,则使用replaceState/pushState将所述网页对应的当前浏览器的URL地址修改为新的URL地址。Preferably, the address modification unit 23 is further specifically used to judge whether the current browser supports the replacement address replaceState/operation address bar address method pushState in the encapsulation page browsing history management class historyM: if the current browser supports replaceState/ pushState, then use replaceState/pushState to modify the URL address of the current browser corresponding to the webpage to a new URL address.
优选的,所述地址修改单元23,进一步具体用于若所述当前浏览器不支持replaceState/pushState,则判断当前浏览器是否支持浏览器哈希改变事件onhashChange事件:若所述当前浏览器支持onhashChange事件,则通过修改location.hash地址来将所述网页对应的当前浏览器的URL地址动态修改为新的URL地址。Preferably, the address modifying unit 23 is further specifically configured to determine whether the current browser supports the browser hash change event onhashChange event if the current browser does not support replaceState/pushState: if the current browser supports onhashChange event, dynamically modify the URL address of the current browser corresponding to the web page to a new URL address by modifying the location.hash address.
优选的,所述地址修改单元23,进一步具体用于若所述当前浏览器不支持onhashChange事件,则通过动态创建浏览器标签iframe插入文档流方式,将所述网页对应的当前浏览器的URL地址动态修改为新的URL地址。Preferably, the address modifying unit 23 is further specifically configured to insert the URL address of the current browser corresponding to the web page by dynamically creating a browser tag iframe into the document stream if the current browser does not support the onhashChange event. Dynamically modify to a new URL address.
本发明实施例上述技术方案具有如下有益效果:实现了在不刷新页面的情况下,动态改变浏览器的地址栏URL,方便网站内容分享;完美兼容各种浏览器记录,实现动态改变浏览器地址,不刷新页面实现功能页面切换;通过pagelets刷新进行一次服务器请求实现页面功能增量切换,减少服务器连接数;在同域页面浏览历史记录最小化,减少冗余历史记录。The above technical solution of the embodiment of the present invention has the following beneficial effects: it realizes dynamically changing the address bar URL of the browser without refreshing the page, which facilitates website content sharing; it is perfectly compatible with various browser records, and realizes dynamically changing the browser address , do not refresh the page to achieve functional page switching; perform a server request through pagelets refresh to realize incremental switching of page functions, reduce the number of server connections; minimize the browsing history of pages in the same domain, and reduce redundant historical records.
以下通过应用实例对本发明实施例上述技术方案进行详述:The above-mentioned technical solutions of the embodiments of the present invention are described in detail below through application examples:
本发明应用实例实现跳转页面模块(以下简称模块)与当前模块需要修改的模块,(如图3所示,为本发明应用实例模块E和模块F刷新示意图)渲染到页面中,替换原来的模块A和模块C,实现页面无刷新切换(模块B、模块D、顶部导航、左侧导航、底部导航均不刷新),并将当前的浏览器地址http://weibo.com/a.html修改为http://weibo.com/b.html。每次页面切换渲染修改地址栏地址后,用户可以复制URL(统一资源定位符)地址到其他电脑中访问,渲染内容和URL(统一资源定位符)当前内容一致。The application example of the present invention realizes the jump page module (hereinafter referred to as the module) and the module that the current module needs to modify, (as shown in Figure 3, it is the application example module E of the present invention and the refresh schematic diagram of module F) and renders it in the page, replacing the original Module A and module C, to achieve page refresh switching (module B, module D, top navigation, left navigation, bottom navigation are not refreshed), and the current browser address http://weibo.com/a.html Modified to http://weibo.com/b.html. After each page switch renders and modifies the address in the address bar, the user can copy the URL (Uniform Resource Locator) address to other computers for access, and the rendered content is consistent with the current content of the URL (Uniform Resource Locator).
URL(统一资源定位符):由以下部分组成:protocol(协议类型)+hostname(主机名)+port(端口号)+path(路径)+?query(查询)(可选,用于给动态网页(传递参数,可有多个参数,用“&”符号隔开,每个参数的名和值用“=”符号隔开)+#hash(哈希)。URL (uniform resource locator): consists of the following parts: protocol (protocol type) + hostname (host name) + port (port number) + path (path) +? query (query) (optional, used to pass parameters to dynamic webpages, there can be multiple parameters, separated by "&" symbol, the name and value of each parameter are separated by "=" symbol) + #hash (ha hope).
本发明应用实例通过封装historyM(页面浏览历史记录管理类),通过提供以下方法集合:setQuery(设置浏览器地址查询参数方法)、pushState(操作地址栏地址方法)、onpopstate(添加地址栏改变回调方法)、removePopstate(移除地址栏改变回调方法)、replaceState(替换地址)、parseURL(解析当前地址方法)等方法,方便用户动态修改浏览器地址,实现在同域网站无刷新页面切换后地址栏修改的功能。用户进行前进/后退功能时,也不产生历史记录。The application example of the present invention is by encapsulating historyM (page browsing history record management class), by providing the following method collection: setQuery (setting browser address query parameter method), pushState (operating address bar address method), onpopstate (adding address bar to change callback method ), removePopstate (remove the address bar and change the callback method), replaceState (replace the address), parseURL (parse the current address method) and other methods, which are convenient for users to dynamically modify the browser address, and realize the address bar modification after switching without refreshing the page on the same domain website function. When the user performs the forward/backward function, no history record is generated.
如图4所示,为本发明应用实例一种基于互联网网页的渲染刷新实现方法流程图,包括:As shown in Figure 4, it is a flow chart of an implementation method for rendering and refreshing based on Internet webpages of an application example of the present invention, including:
401、当一客户端的某一网页对应的整个页面中的一个或多个页面模块刷新时,获取所述一个或多个页面模块的刷新数据;401. When one or more page modules in the entire page corresponding to a certain webpage of a client are refreshed, obtain refresh data of the one or more page modules;
402、将所述一个或多个页面模块的刷新数据渲染到所述网页对应的整个页面中,替换原来所述一个或多个页面模块的原数据;402. Render the refresh data of the one or more page modules into the entire page corresponding to the web page, and replace the original data of the one or more page modules;
403、判断当前浏览器是否支持replaceState/pushState:若所述当前浏览器支持replaceState/pushState,则转404;若所述当前浏览器不支持replaceState/pushState,则转405;403. Determine whether the current browser supports replaceState/pushState: if the current browser supports replaceState/pushState, go to 404; if the current browser does not support replaceState/pushState, go to 405;
404、使用replaceState/pushState将所述网页对应的当前浏览器的URL地址修改为新的URL地址,然后转408。404. Use replaceState/pushState to modify the URL address of the current browser corresponding to the web page to a new URL address, and then go to 408.
405、判断当前浏览器是否支持onhashChange事件:若所述当前浏览器支持onhashChange事件,则转406;若所述当前浏览器不支持onhashChange事件,则转407;405. Determine whether the current browser supports the onhashChange event: if the current browser supports the onhashChange event, turn to 406; if the current browser does not support the onhashChange event, turn to 407;
406、通过修改location.hash地址来将所述网页对应的当前浏览器的URL地址动态修改为新的URL地址,然后转408。406. Dynamically modify the URL address of the current browser corresponding to the web page to a new URL address by modifying the location.hash address, and then go to 408.
407、通过动态创建iframe插入文档流方式,将所述网页对应的当前浏览器的URL地址动态修改为新的URL地址,然后转408。407. Dynamically modify the URL address of the current browser corresponding to the web page to a new URL address by dynamically creating an iframe to insert into the document stream, and then go to 408.
408、结束。408. End.
本发明应用实例上述技术方案实现了在不刷新页面的情况下,动态改变浏览器的地址栏URL,方便网站内容分享;完美兼容各种浏览器记录,实现动态改变浏览器地址,不刷新页面实现功能页面切换;通过pagelets刷新进行一次服务器请求实现页面功能增量切换,减少服务器连接数;在同域页面浏览历史记录最小化,减少冗余历史记录。Application examples of the present invention The above technical scheme realizes dynamically changing the address bar URL of the browser without refreshing the page, which is convenient for website content sharing; it is perfectly compatible with various browser records, and realizes dynamically changing the browser address without refreshing the page. Functional page switching; through pagelets refreshing a server request to realize incremental switching of page functions, reducing the number of server connections; minimizing the browsing history of pages in the same domain, reducing redundant historical records.
本领域技术人员还可以了解到本发明实施例列出的各种说明性逻辑块(illustrative logical block),单元,和步骤可以通过电子硬件、电脑软件,或两者的结合进行实现。为清楚展示硬件和软件的可替换性(interchangeability),上述的各种说明性部件(illustrative components),单元和步骤已经通用地描述了它们的功能。这样的功能是通过硬件还是软件来实现取决于特定的应用和整个系统的设计要求。本领域技术人员可以对于每种特定的应用,可以使用各种方法实现所述的功能,但这种实现不应被理解为超出本发明实施例保护的范围。Those skilled in the art can also understand that various illustrative logical blocks, units, and steps listed in the embodiments of the present invention can be implemented by electronic hardware, computer software, or a combination of both. To clearly demonstrate the interchangeability of hardware and software, the various illustrative components, units and steps above have generally described their functions. Whether such functions are implemented by hardware or software depends on the specific application and overall system design requirements. Those skilled in the art may use various methods to implement the described functions for each specific application, but such implementation should not be understood as exceeding the protection scope of the embodiments of the present invention.
本发明实施例中所描述的各种说明性的逻辑块,或单元都可以通过通用处理器,数字信号处理器,专用集成电路(ASIC),现场可编程门阵列或其它可编程逻辑装置,离散门或晶体管逻辑,离散硬件部件,或上述任何组合的设计来实现或操作所描述的功能。通用处理器可以为微处理器,可选地,该通用处理器也可以为任何传统的处理器、控制器、微控制器或状态机。处理器也可以通过计算装置的组合来实现,例如数字信号处理器和微处理器,多个微处理器,一个或多个微处理器联合一个数字信号处理器核,或任何其它类似的配置来实现。Various illustrative logic blocks or units described in the embodiments of the present invention can be discretely processed by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic devices. Gate or transistor logic, discrete hardware components, or any combination of the above designed to implement or operate the described functions. The general-purpose processor may be a microprocessor, and optionally, the general-purpose processor may also be any conventional processor, controller, microcontroller or state machine. A processor may also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration to accomplish.
本发明实施例中所描述的方法或算法的步骤可以直接嵌入硬件、处理器执行的软件模块、或者这两者的结合。软件模块可以存储于RAM存储器、闪存、ROM存储器、EPROM存储器、EEPROM存储器、寄存器、硬盘、可移动磁盘、CD-ROM或本领域中其它任意形式的存储媒介中。示例性地,存储媒介可以与处理器连接,以使得处理器可以从存储媒介中读取信息,并可以向存储媒介存写信息。可选地,存储媒介还可以集成到处理器中。处理器和存储媒介可以设置于ASIC中,ASIC可以设置于用户终端中。可选地,处理器和存储媒介也可以设置于用户终端中的不同的部件中。The steps of the method or algorithm described in the embodiments of the present invention may be directly embedded in hardware, a software module executed by a processor, or a combination of both. The software modules may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM or any other storage medium in the art. Exemplarily, the storage medium can be connected to the processor, so that the processor can read information from the storage medium, and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be set in the ASIC, and the ASIC can be set in the user terminal. Optionally, the processor and the storage medium may also be set in different components in the user terminal.
在一个或多个示例性的设计中,本发明实施例所描述的上述功能可以在硬件、软件、固件或这三者的任意组合来实现。如果在软件中实现,这些功能可以存储与电脑可读的媒介上,或以一个或多个指令或代码形式传输于电脑可读的媒介上。电脑可读媒介包括电脑存储媒介和便于使得让电脑程序从一个地方转移到其它地方的通信媒介。存储媒介可以是任何通用或特殊电脑可以接入访问的可用媒体。例如,这样的电脑可读媒体可以包括但不限于RAM、ROM、EEPROM、CD-ROM或其它光盘存储、磁盘存储或其它磁性存储装置,或其它任何可以用于承载或存储以指令或数据结构和其它可被通用或特殊电脑、或通用或特殊处理器读取形式的程序代码的媒介。此外,任何连接都可以被适当地定义为电脑可读媒介,例如,如果软件是从一个网站站点、服务器或其它远程资源通过一个同轴电缆、光纤电缆、双绞线、数字用户线(DSL)或以例如红外、无线和微波等无线方式传输的也被包含在所定义的电脑可读媒介中。所述的碟片(disk)和磁盘(disc)包括压缩磁盘、镭射盘、光盘、DVD、软盘和蓝光光盘,磁盘通常以磁性复制数据,而碟片通常以激光进行光学复制数据。上述的组合也可以包含在电脑可读媒介中。In one or more exemplary designs, the above functions described in the embodiments of the present invention may be implemented in hardware, software, firmware or any combination of the three. If implemented in software, the functions can be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes computer storage media and communication media that facilitate transfer of a computer program from one place to another. Storage media may be any available media that can be accessed by a general purpose or special computer. For example, such computer-readable media may include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other device that can be used to carry or store instructions or data structures and Other medium of program code in a form readable by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. In addition, any connection is properly defined as a computer-readable medium, for example, if the software is transmitted from a website site, server, or other remote source via a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) Or transmitted by wireless means such as infrared, wireless and microwave are also included in the definition of computer readable media. Disks and discs include compact discs, laser discs, optical discs, DVDs, floppy discs, and Blu-ray discs. Disks usually reproduce data magnetically, while discs usually reproduce data optically with lasers. Combinations of the above can also be contained on a computer readable medium.
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The specific embodiments described above have further described the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above descriptions are only specific embodiments of the present invention and are not intended to limit the scope of the present invention. Protection scope, within the spirit and principles of the present invention, any modification, equivalent replacement, improvement, etc., shall be included in the protection scope of the present invention.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510220673.2A CN104850602B (en) | 2015-05-04 | 2015-05-04 | A kind of rendering refreshing implementation method and device based on internet web page |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510220673.2A CN104850602B (en) | 2015-05-04 | 2015-05-04 | A kind of rendering refreshing implementation method and device based on internet web page |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104850602A CN104850602A (en) | 2015-08-19 |
CN104850602B true CN104850602B (en) | 2018-11-27 |
Family
ID=53850247
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510220673.2A Active CN104850602B (en) | 2015-05-04 | 2015-05-04 | A kind of rendering refreshing implementation method and device based on internet web page |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104850602B (en) |
Families Citing this family (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105528426B (en) * | 2015-12-09 | 2019-03-26 | 国云科技股份有限公司 | Non-refreshing URL parameter dynamic record loading method |
CN105607927A (en) * | 2015-12-18 | 2016-05-25 | 小米科技有限责任公司 | Page display method and apparatus |
US10083244B2 (en) * | 2016-02-12 | 2018-09-25 | Costar Realty Information, Inc. | Uniform resource identifier encoding |
CN108446279A (en) * | 2016-08-14 | 2018-08-24 | 天脉聚源(北京)科技有限公司 | A kind of mobile terminal shows the method and system of multiple web pages |
CN108108381B (en) * | 2016-11-25 | 2021-06-22 | 北京国双科技有限公司 | Page monitoring method and device |
CN107391169A (en) * | 2017-06-09 | 2017-11-24 | 口碑控股有限公司 | The dynamic updating method and device of the Android page |
CN107678820B (en) * | 2017-09-29 | 2021-08-24 | 北京金山安全软件有限公司 | Webpage processing method, device, server, terminal equipment and medium |
US10956498B2 (en) * | 2017-09-29 | 2021-03-23 | Google Llc | Scanning for bindings in webpage markup |
CN110020287A (en) * | 2017-09-29 | 2019-07-16 | 北京国双科技有限公司 | The loading method and device of webpage thermodynamic |
CN110020323B (en) * | 2018-07-27 | 2023-04-07 | 平安科技(深圳)有限公司 | Page switching method and system for hybrid application, computer equipment and storage medium |
CN109309859A (en) * | 2018-09-30 | 2019-02-05 | 广州虎牙信息科技有限公司 | Direct broadcasting room method for showing interface, framework and correlation technique, device and equipment |
CN110471709B (en) * | 2019-07-15 | 2022-12-06 | 北京字节跳动网络技术有限公司 | Method, device, medium and electronic equipment for accelerating webpage opening speed |
CN110516189B (en) * | 2019-08-29 | 2023-04-18 | 深圳市今天国际物流技术股份有限公司 | Interface self-service method, device, computer equipment and storage medium |
CN111177606B (en) * | 2019-12-23 | 2023-12-15 | 望海康信(北京)科技股份公司 | Method and device for controlling browser to render webpage |
CN111382387B (en) * | 2020-03-06 | 2023-10-24 | 深圳市盟天科技有限公司 | Webpage access method, device, equipment and storage medium based on applet |
CN112559172A (en) * | 2020-12-08 | 2021-03-26 | 百果园技术(新加坡)有限公司 | Method, system, equipment and storage medium for optimizing memory of web browser |
CN114629812A (en) * | 2022-03-28 | 2022-06-14 | 中国电子科技集团公司第三十八研究所 | Cluster visualization system and method based on autonomous controllable platform |
CN115563428A (en) * | 2022-07-20 | 2023-01-03 | 合肥汉泰网络科技有限公司 | Method, system and computer equipment for rewriting virtual path of browser end |
CN115952367A (en) * | 2022-12-01 | 2023-04-11 | 支付宝(杭州)信息技术有限公司 | A page display method, device and equipment |
CN115858987B (en) * | 2023-02-21 | 2023-04-25 | 成都萌想科技有限责任公司 | Method and device for rendering H5 question bank webpage, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1937503A (en) * | 2005-09-23 | 2007-03-28 | 千橡世纪科技发展(北京)有限公司 | System and method for speeding up webpage content downloading |
CN101571865A (en) * | 2008-04-30 | 2009-11-04 | 北京盖特佳信息安全技术股份有限公司 | Method for achieving dynamic website portal column based on AJAX technique |
CN103166916A (en) * | 2011-12-12 | 2013-06-19 | 深圳市金蝶中间件有限公司 | Method and system for updating page |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6266684B1 (en) * | 1997-08-06 | 2001-07-24 | Adobe Systems Incorporated | Creating and saving multi-frame web pages |
-
2015
- 2015-05-04 CN CN201510220673.2A patent/CN104850602B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1937503A (en) * | 2005-09-23 | 2007-03-28 | 千橡世纪科技发展(北京)有限公司 | System and method for speeding up webpage content downloading |
CN101571865A (en) * | 2008-04-30 | 2009-11-04 | 北京盖特佳信息安全技术股份有限公司 | Method for achieving dynamic website portal column based on AJAX technique |
CN103166916A (en) * | 2011-12-12 | 2013-06-19 | 深圳市金蝶中间件有限公司 | Method and system for updating page |
Non-Patent Citations (1)
Title |
---|
HTML5无刷新修改URL;JavaScript;《https://web.archive.org/web/20130618105224/http://www.qttc.net/201303292.html》;20130618;1-5 * |
Also Published As
Publication number | Publication date |
---|---|
CN104850602A (en) | 2015-08-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104850602B (en) | A kind of rendering refreshing implementation method and device based on internet web page | |
KR101824222B1 (en) | Fast rendering of websites containing dynamic content and stale content | |
US9282145B2 (en) | Systems and methods for managing loading priority or sequencing of fragments of a web object | |
US7870482B2 (en) | Web browser extension for simplified utilization of web services | |
CN103942225B (en) | A kind of resource transfer method, client and the system of mixed type applications client | |
US10291738B1 (en) | Speculative prefetch of resources across page loads | |
US20170272499A1 (en) | Method and device for loading webpage | |
US10284671B2 (en) | Dynamic bundling of web components for asynchronous delivery | |
US20120254727A1 (en) | Methods and systems for generating and displaying a preview image of a content area | |
CN104778211A (en) | Method, client, server and system for refreshing partial page modules | |
US9547633B2 (en) | Methods for extending a selector application programming interface and devices thereof | |
US10116726B2 (en) | Methods for bundling images and devices thereof | |
WO2023092580A1 (en) | Page display method and apparatus, storage medium, and electronic device | |
CN114528510A (en) | Webpage data processing method and device, electronic equipment and medium | |
WO2019071406A1 (en) | Front-end page internationalization processing method, application server and computer readable storage medium | |
CN104750817B (en) | A kind of page module method for refreshing and device based on data broadcast communication | |
CN111767498B (en) | Method and device for realizing file information sharing | |
US11487931B1 (en) | Replaying a webpage based on virtual document object model | |
US10296580B1 (en) | Delivering parsed content items | |
US20140237133A1 (en) | Page download control method, system and program for ie core browser | |
CN117675238A (en) | Data access method, device, electronic equipment and storage medium | |
US20150248499A1 (en) | Optimized read/write access to a document object model | |
CN114548079B (en) | Text display method and device and readable storage medium | |
TWI610183B (en) | An operational system for centralized management base on ajax website | |
CN118170414A (en) | Web page updating method, device, electronic device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |