【问题标题】:Refreshing parent page refreshes child instead, Salesforce刷新父页面改为刷新子页面,Salesforce
【发布时间】:2012-05-01 15:44:55
【问题描述】:

我在salesforce的一个页面上有一个自定义按钮,这个按钮触发一个js代码

 window.open("{!$Label.SF_Base_URL}/apex/DeletePageiFrame",300,300);

DeletePageiFrame 是一个顶点页面,它有一个 iframe(用于外部网站)和一个在点击时应该刷新父窗口的按钮。

<form>
<INPUT TYPE="button" NAME="myButton" onclick="handleOnClose();" value="press to close"/>
</form>

 //the js function
function handleOnClose() 
 {
    alert(window.parent.location); // this gives child window location instead
   window.parent.location.reload();  //refreshes child not parent  
//  window.top.location.reload();

// all the functions bellow didnt work.
 //  window.opener.location.reload(true);
  // window.opener.location.reload(false);   
   //  opener.location.reload();
   //  opener.reload();
    // window.opener.location.reload();
    // document.opener.document.location.href = document.opener.document.location.href;

 }

我还尝试触发窗口关闭事件来调用父窗口刷新,但我遇到了 chrome 问题,并且子窗口被刷新而不是父窗口。

<script> window.onBeforeUnload=handleOnClose();</script>

【问题讨论】:

    标签: javascript salesforce apex-code


    【解决方案1】:

    问题是因为我的帐户启用了开发模式。如果您启用了它并且发现发生了一些奇怪的事情,请禁用它并重试。开发模式目前存在一些问题。

    【讨论】:

    • 我在不止一次使用 JavaScript 时遇到过开发模式混乱。我建议不要使用它。
    猜你喜欢
    • 1970-01-01
    • 2011-02-12
    • 2011-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多