Jquery refreshes the iframe page (compatible with mainstream)

Source: Internet
Author: User

1. reload method, which forces the browser to refresh the current page.
Syntax: location. reload ([bForceGet])
Parameter: bForceGet. An optional parameter. The default value is false. The current page is retrieved from the client cache. True, the GET method is used to obtain the latest page from the server, which is equivalent to clicking F5 ("refresh") on the client ")

The code is as follows: Copy code
<Script language = "JavaScript">
Window. location. reload ();
</Script>



In this way, the page is refreshed. Of course there are other methods, so how should we refresh the Framework page?

The code is as follows: Copy code

// Method 1

Document. getElementById ('frameid'). contentWindow. location. reload (true );


// Method 2
Document. getElementById ('youriframe'). src = src;



Instance:

The code is as follows: Copy code
<Iframe id = "myframe" width = "100%" frameBorder = "0" src = "test.html" scrolling = "no"> </iframe>
<Input type = "button" onclick = "javascript: refreshFrame ();" value = "Refresh Frame"/>
 
<Script type = "text/javascript">
<! --
Function refreshFrame (){
Document. getElementById ('myframework'). contentWindow. location. reload (true );
}
// -->
</Script>



II. Jquery implements force refresh


$ ('# Iframe'). attr ('src', $ ('# iframe'). attr ('src '));

3,If you want to refresh a new page, use the following code to refresh it.

The code is as follows: Copy code
// Refresh the page containing the framework
<Script language = JavaScript>
Parent. location. reload ();
</Script>
// Refresh the parent window in the child window
<Script language = JavaScript>
Self. opener. location. reload ();
</Script>
(Or <a href = "javascript: opener. location. reload ()"> refresh </a>)
// Refresh the page of another framework
<Script language = JavaScript>
Parent. Another FrameID. location. reload ();
</Script>



Summary: A lot of documents. frames ('ifrmname'). location. reload () are no longer available on the Internet.

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.