+ Start a Discussion
Volker_factory42Volker_factory42 

Avoid URL parameter inline=1

I have a visualforcepage which is included in a layoutpage.

Viewlayout of this object has an override with another visual force page.

 

When I  call a pagereference methode from "inline" visualforcepage an try to leave the Iframe and load current objectpage again, salesforce creates a new URL with parameter inline=1.

By this parameter, Header and Sidebar is invisible. 

 

Code:

<apex:commandlink styleClass="btn newButton" style="text-decoration: none; margin: 2px !important;" value="Click" action="{!executeAction}" target="_parent">
</apex:commandlink>
pageRef = Page.NAME;
pageRef.getParameters().put('id',OBJECT.Id);
//pageRef = new ApexPages.StandardController(OBJECT).view();

 

 Is there a possibility to avoid getting parameter inline=1?

 

I tried:

  • new parameter inline=0
  • URL as a string
  • new redirect visualforce page

 

without success...

 

Volker_factory42Volker_factory42

Does anybody has a solution for that?

@Salesforce: Any workarounds?

Vishal GuptaVishal Gupta
i suggest u to try inline=0 explicitly......otherwise i think there is no way.
k_wrightk_wright

 

I am having this same problem. Some info about the last suggestion (setting inline=0): it seems that the page will display inline if the 'inline' query attribute is present regardless of its value. In other words, both of these URLs will display a page inline: 

 

https://c.na9.visual.force.com/apex/procaseedit?inline=false

https://c.na9.visual.force.com/apex/procaseedit?inline=0

https://c.na9.visual.force.com/apex/procaseedit?inline

 

 

It looks as if the only way to not display inline is to remoe the param altogether. Since it's added automatically by the force.com platform, I don't know how to go about doing that. 

 

Here are some implementation details: 

 

The VF page that is displayed within the contact layout: 

<apex:page standardController="Contact" extensions="ProCaseContactController">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock title="Pro Cases">
<apex:form >
<apex:commandButton action="{!editRemoteProCase}" value="Create Remote Pro Case"/>
</apex:form>
</apex:pageBlock>
</apex:page>

 

 

The controller action for the page:

 

public with sharing class ProCaseContactController {

... 

public PageReference editRemoteProCase() {
PageReference editPage = new PageReference(Page.ProCaseEdit.getUrl());
editPage.setRedirect(true);
editPage.getParameters().put('object', 'Contact');
editPage.getParameters().put('Id', this.contact.id);
return editPage;
}

 

And the URL that is next shown is: 

 

https://c.na8.visual.force.com/apex/procaseedit?Id=003E000000FkegtIAB&object=Contact&inline=1

 

 

With the exception of not having the sidebar & header, the page displays and functions properly.

 

Any ideas on how to either remove the inline=1 param or refresh? I'm going to try adding a check for the parameter in the controller and then redirecting again but without the parameter if it's found. Very lame, though, since that requires a second server request..

 

Thanks. 

k_wrightk_wright

Update: I tried redirecting with a removed 'inline' param, and it didn't work. What ended up happening was an endless redirection to the url *with* the inline=1 param included: 

 

public PageReference proCaseEdit() {
    Id id = ApexPages.currentPage().getParameters().get('Id');
    String objectType = ApexPages.currentPage().getParameters().get('object');
    String inline = ApexPages.currentPage().getParameters().get('inline');


    System.debug('%%%%%%%%%%%%%% inline param: ' + inline);

 

    if (inline != null) {
        PageReference editPage = new PageReference(Page.ProCaseEdit.getUrl());
        editPage.setRedirect(true);
        editPage.getParameters().put('object', objectType);
        editPage.getParameters().put('Id', id);
        editPage.getParameters().remove('inline');

 

        System.debug('%%%%%%%%%%%% params: ' + editPage.getParameters());

 

        return editPage;
    }

    [...]

 

The log lines are: 

 

12:01:09.219 (219432000)|USER_DEBUG|[13]|DEBUG|%%%%%%%%%%%%%% inline param: 1

  and

12:01:09.219 (219958000)|USER_DEBUG|[20]|DEBUG|%%%%%%%%%%%% params: {Id=003E000000FkegtIAB, object=Contact}

 

The upshot is that manually removing the inline parameter does not seem to work. 

k_wrightk_wright

Adding this js snippet just before the </apex:page> tag does the trick, but I'd love to hear a better solution: 

 

<script>
     var url = location.href;
     var match = url.match(/inline=1/);
    if (match != null) { 
        var newUrl = url.replace(/inline=1/, '');
        window.top.location=newUrl;
    }
</script>

 

 

Marc C.Marc C.
Nice!

if (location.href.match(/inline=1/)) window.top.location=location.href.replace(/inline=1/, '');
SF_GuhaSF_Guha

.....

 

Thanks a Lot for the Workaround !!!

It works !! :)