JQuery captures hyperlink events for partial refresh

Source: Internet
Author: User




When using the Google UI, open a hyperlink on the current page. The page will be refreshed locally as needed, instead of replacing the entire page. When you select a new window to open a hyperlink, the hyperlink can still reach the expected page.
<Html>
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<Title> A Click Event Test </title>
<Script type = "text/javascript" src = "jquery. min. js"> </script>
<Script type = "text/javascript">
$ (Function (){
/* Click events will occur before the hyperlink jump */
$ ("# Div_test a"). click (function (){
Var link = $ (this). attr ('href ');
$ ('# Div_view'). attr ('src', link );
Var href = window. location. href;
Window. location. href = href. substr (0, href. indexOf ('#') + '#' + link;
Return false;
});
});
</Script>
</Head>
<Body>
<Div id = "div_test">
<Ol>
<Li> <a href = "http://xiaoxia.org"> xiaoxia </a> </li>
<Li> <a href = "http://www.ibaiyang.org"> ibaiyang </a> </li>
<Li> <a href = "http://www.xiaoxins.com"> xiaoxins.com </a> </li>
</Ol>
</Div>
<Iframe id = "div_view" width = "100%"> </iframe>
</Body>
</Html>
This is just a test I performed with jQuery and I don't know how Google implements it. For example, after clicking a hyperlink event, the page uses iframe to perform partial refresh. At this time, the browser's address bar should change. How can this be changed?
Currently, I modify window. location to change the address, but I can only change the content after # symbol. If the previous content changes, the browser may refresh the entire page?

 
From Xiaoxia

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.