This is a VF page that is embedded in a STD layout. It's function is to conditionally render, display a warning, and do a redirect.


This code works fine in IE 9, FF, and chrome, but NOT IE 8. What am I doing wrong/what's going on? The user clicks the 'ok' btn and he doesn't go anywhere. I tried this in Compatibility and Non-Compatiblity mode. OR the user will get sent to the "URL No Longer Exists" page.

<apex:page standardController="Opportunity"  standardStylesheets="true" extensions="OpportunityController"  >
    <body style="background:#f3f3ec" > 
        <apex:form id="form">
                function onComplete2(){
                    var r=confirm("Click OK to continue and change the Record Type without saving changes. To save any changes, click cancel and then save your work");
                    if (r==true){
                       window.parent.parent.window.location = ("{!redirect}");
                <apex:commandButton action="{!save}" reRender="form" onComplete="onComplete2()" value="Change Record Type"/>


public with sharing class OpportunityController {

    String oppId;

    public OpportunityController(ApexPages.StandardController controller) {
        this.oppId = ApexPages.currentPage().getParameters().get('id');

    public PageReference getredirect(){
        PageReference p;
        String s = '/setup/ui/recordtypeselect.jsp?id=' + this.oppId +'&retURL=%2F'+ this.oppId;
        p = new PageReference(s);
        return p;   

    public boolean getRender(){
       if ( UserInfo.getProfileid().left(15) == '00e30000000bulF') {  //00e30000000bulF = sys admin.
           return true;

      Group g = [select id from group where developerName = 'test'];
      List <GroupMember> gm = [Select UserOrGroupId, GroupId From GroupMember where groupId = :g.id];
      for(GroupMember x: gm){
          if (userinfo.getUserId().left(15) == x.UserOrGroupId){
              return true;
    return false;           
  • Just a guess did you try window.location.href instead and see if the redirect works? – Rao Sep 26 '13 at 22:29
  • In IE in the bottom left corner check for yellow triangle with exclamation mark icon and check if there are any errors – Boris Bachovski Sep 26 '13 at 22:44
  • @rao I tried that, and instead of the btn doing nothing, it now goes to a page "URL No Longer Exists" before it wouldn't do anything – PartOfTheOhana Sep 27 '13 at 1:17
  • Can you please view the source of the page in IE and paste the code that is on line 7? – Boris Bachovski Sep 27 '13 at 1:24
  • 1
    Try window.top.location.href = '{!redirect}'; – Sam Sep 27 '13 at 4:30

I had a similar problem. The code worked in Firefox and Chrome but didn't work on Internet Explorer 8. Here's what I have come up with!

Try replacing your

<apex:commandButton action="{!save}" reRender="form" onComplete="onComplete2()" value="Change Record Type"/>


<apex:commandButton action="{!save}" reRender="form" onComplete="return onComplete2();" value="Change Record Type"/>
  • Optionally, raise the quality bar for your users and demand they at least use ie9. I realize tats not always possible etc. but it's good to fight the good fight. – Kevin P Oct 31 '13 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.