How jquery refreshes the IFRAME page

Source: Internet
Author: User

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

Syntax: Location.reload ([Bforceget])

Parameters: Bforceget, optional parameter, default is False, the current page is taken from the client cache. True, the latest page from the server is taken as a GET, equivalent to the client clicking F5 ("Refresh")

123 <script language="JavaScript">window.location.reload();</script>

1234567 //方法1document.getElementById(‘FrameID‘).contentWindow.location.reload(true);//方法2document.getElementById(‘youriframe‘).src=src;

Instance:

12345678910 <iframe id="myframe" width="100%" frameBorder="0" src="test.html" scrolling="no"></iframe><inputtype="button" onclick="javascript:refreshFrame();" value="Refresh Frame" /> <scripttype="text/javascript"><!--function refreshFrame(){    document.getElementById(‘myframe‘).contentWindow.location.reload(true);}//--></script>

Two. jquery implements forced refresh

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

12345678910111213 //刷新包含该框架的页面用  <scriptlanguage=JavaScript>   parent.location.reload();</script>//子窗口刷新父窗口<scriptlanguage=JavaScript>    self.opener.location.reload();</script>( 或 <ahref="javascript:opener.location.reload()">刷新</a>   )//刷新另一个框架的页面用  <scriptlanguage=JavaScript>   parent.另一FrameID.location.reload();</script>

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

Self-validation

Dynamically loading the contents of a subform in a page,

123 $("#refresh").click(function(){     parent.location.reload();});

Refresh the current Subform

            $ ("#refresh"). Click (function () {                self.location.reload ();            });

Can work

How jquery refreshes the IFRAME page

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.