2

Looks like it is possible to create some static resource AdvDev with pdf content and define following VisualForce redirect page which would redirect and display that pdf document

<apex:page action="{!URLFOR($Resource.AdvDev)}">

But... Why there is no information in the documentation that page action support URL parameter? https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm

action ApexPages.Action The action method invoked when this page is requested by the server. Use expression language to reference an action method. For example, action="{!doAction}" references the doAction() method in the controller. If an action is not specified, the page loads as usual. If the action method returns null, the page simply refreshes. This method will be called before the page is rendered and allows you to optionally redirect the user to another page. This action should not be used for initialization.

Why documentation says that action parameters supports only ApexPages.Action? Why doesn't it clearly specify that URL is also allowed there?

1 Answer 1

0

Follow-up

I think this page: Setting Custom HTML Attributes on Visualforce Components may answer your follow-up questions in comments.

You can add arbitrary attributes to many Visualforce components that are “passed through” to the rendered HTML. This is useful, for example, when using Visualforce with JavaScript frameworks, such as jQuery Mobile, AngularJS, and Knockout, which use data-* or other attributes as hooks to activate framework functions.

Pass-through attributes can also be used to improve usability with HTML5 features such as placeholder “ghost” text, pattern client-side validation, and title help text attributes.

The behavior of HTML5 features is determined by the user’s browser, not Visualforce, and varies considerably from browser to browser. If you want to use these features, test early and often on every browser and device you plan to support.

Also, <apex:page> is in the list of components where pass-through attributes are supported.

The important thing to take-away from the above is that just because something compiles, it doesn't mean that it will work or do anything.

Original Answer

I believe the reference you've cited is referring to an Action Method within a Apex Page Controller which could return a Page Reference to a different URL than the page which is being loaded. There's no information on page action support for URL parameters because there is none. See Defining Action Methods for more details and examples of what the reference you cited is referring to.

4
  • Why the case the page which is being loaded is different? Commented Sep 8, 2015 at 17:33
  • I mean, I still don't understand, why this code is eligible <apex:page action="{!URLFOR($Resource.AdvDev)}"> - if action supports only actions, it should give save error on save try saying that {!URLFOR($Resource.AdvDev)} is not an action Commented Sep 8, 2015 at 17:34
  • See my follow-up comments in answer above
    – crmprogdev
    Commented Sep 8, 2015 at 18:09
  • 1
    @XpucTuHKaBuwuBaHKa : An action method returns a page reference (or null), URLFOR in effect returns a page reference - hence both work. URLFOR is one of the worst-documented features in terms of examples and use cases
    – cropredy
    Commented Sep 9, 2015 at 1:10

You must log in to answer this question.

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