1

I'd like to know if this is possible at all. What I want to do is to create a wrapper VisualForce page which simply takes a URL as a parameter, and renders it. I have tried this, but it renders the HTML text and not the page. Any suggestions?

Thx, Hamayoun

Controller:

public class wrapper1 {

public String output {set;get;}

public wrapper1 () {

    String url1 = ApexPages.currentPage().getParameters().get('url1') ;
    PageReference pr = new PageReference (url1);
    output = pr.getContent().toString();

}

}

VisualForce:

<apex:page controller="wrapper1">
<apex:outputPanel>
  {!output}
    </apex:outputPanel>
</apex:page>
2

Warning: What your proposing to do is a significant security issue. I'd highly suggest that you severely restrict where the page will pull HTML in from or look for a different option.

See also: HTML Injection


Try switching to an apex:outputText and setting the escape attribute to false. This will stop Salesforce from HTML escaping the content.

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.