Determining Pagelet Running Location
You can determine whether your code is running within the portal environment (that is being invoked by means of an https request coming from a portal servlet) as opposed to running in on the system outside of the portal environment. The PeopleCode %RunningInPortal system variable returns a Boolean value that identifies the environment. This variable works in both iframe templates and HTML templates.