1

Command button with oncomplete attribute does not work when development footer is Enabled.

<apex:page controller="google_redir">
<apex:form>
    <apex:commandButton action="{! hello1}"  value="button 1"/>
    <apex:commandButton action="{! hello1}"  value="button 2" oncomplete="alert('onComplete called');" reRender="here"/>
    <apex:outputPanel id="here">{!NOW()}</apex:outputPanel>
</apex:form>
</apex:page>

Controller:

public class google_redir{
public PageReference hello1(){
    PageReference reference=new PageReference('https://www.google.com');
    reference.setRedirect(true);
    return reference;
}
}

Error which I get in chrome console

Refused to display 'https://www.google.co.in/?gfe_rd=cr&ei=1MpEVKi4MaXV8gf18YGACw' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. TestPage?core.apexpages.devmode.url=1:1 Uncaught SecurityError: Sandbox access violation: Blocked a frame at "https://c.ap1.visual.force.com" from accessing a frame at "https://c.ap1.visual.force.com". The frame being accessed is sandboxed and lacks the "allow-same-origin" flag. VFDevModeWithViewstate.js:21 Uncaught SecurityError: Failed to read the 'cookie' property from 'Document': The document is sandboxed and lacks the 'allow-same-origin' flag.

2
  • Errors which I get in chrome console
    – user9792
    Oct 20, 2014 at 8:42
  • Refused to display 'google.co.in/?gfe_rd=cr&ei=1MpEVKi4MaXV8gf18YGACw' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. TestPage?core.apexpages.devmode.url=1:1 Uncaught SecurityError: Sandbox access violation: Blocked a frame at "c.ap1.visual.force.com" from accessing a frame at "c.ap1.visual.force.com". The frame being accessed is sandboxed and lacks the "allow-same-origin" flag. VFDevModeWithViewstate.js:21 Uncaught SecurityError: Failed to read the 'cookie' property from 'Document': The document is sandboxed and lacks the 'allow-same-origin' flag.
    – user9792
    Oct 20, 2014 at 8:43

1 Answer 1

2

This is not the first time I've heard of the development footer (aka inline page editor) interfering with code on the actual page. I've normally had this happen when using third-part JS libs and the like. I've not heard this happen with an entire event handler. It sounds like some kind of clash with the event handler

When this happens you'll just need to resort to an alternative means of building your page.

I know this is inconvenient, but actually I find editing my pages in the Developer Console and using the built-in preview feature there nearly as convenient...especially if you have a big enough monitor (or a couple of monitors). To be honest, I've stopped using the inline page editor entirely in favor of the Developer Console when I use the web-based tools for working with Visualforce. Once you've launched the preview, saving Visualforce in the Developer Console does an automatic refresh (if the tab is the active tab) of the VF preview anyway. Plus it removes the clunky inline editor.

2
  • was about to explode becos of this error.. ur reply helped me.. but why is this so random and will this ever get fixed ? Oct 12, 2015 at 18:31
  • I wouldn't hold my breath. Especially when the workaround (Developer Console) has gotten so much better.
    – pchittum
    Oct 12, 2015 at 21:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .