How jquery refreshes the IFRAME page

Source: Internet
Author: User

1,reload method that forces the browser to refresh the current page.

Syntax: Location.reload ([Bforceget])

Parameters: Bforceget, optional parameter, default to False, take the current page from the client cache. True to get the latest page from the service, equivalent to the client-click F5 ("Refresh")

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

This enables the page to refresh, of course, there are other ways, then to refresh the frames page How do we operate

The code is as follows

Method 1

document.getElementById (' Frameid '). ContentWindow.location.reload (True);


Method 2
document.getElementById (' Youriframe '). src=src;

Instance:

The code is as follows
<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 (' MyFrame '). ContentWindow.location.reload (True);
}
-->
</script>

Two. jquery Implementation Force Refresh

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

Third, if it is open new page we want to refresh the words can use the following code to brush Pro

The code is as follows
Refresh the page that contains the frame with
<script language=javascript>
Parent.location.reload ();
</script>
child window refreshes parent window
<script language=javascript>
Self.opener.location.reload ();
</script>
(or <a href= "javascript:opener.location.reload ()" > Refresh </a>)
The page that refreshes another frame is used
<script language=javascript>
Parent. Another FrameID.location.reload ();
</script>

Summary: A lot of document.frames on the net (' Ifrmname '). Location.reload () is no longer available.

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.