function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

VF homepage components: why are different URLs for iframes used?

Hi. In Salesforce we can create a Visualforce homepage component which is based on a custom VF page. This component is displayed in IFRAME in the sidebar. We found that SF uses 2 diffirent types of URLs for these iframes in different orgs:
  • in the most of cases it generates absolute URLs:
    frameborder="0" id="contentPane" name="contentPane"
    onload="initContentFrame(';;inline=1&amp;autoMapValues=1&amp;;core.apexpages.devmode.url=1', true, false , '' );"
    src="/blank.html" style="width: 100%; height: 100%" title="Content Pane"
  • in few orgs it generates relative URLs:
    frameborder="0" id="contentPane" name="contentPane"
    onload="initContentFrame('/apex/MyCustomPage?core.apexpages.framework.ApexViewServlet.getInlinedContentRequest=1&amp;;inline=1&amp;autoMapValues=1&amp;;core.apexpages.devmode.url=1', true, false , '' );"
    src="/blank.html" style="width: 100%; height: 100%" title="Content Pane">

The 2nd approach does not work if we open any Visualforce page from an AppExchange package, because such pages are based on a specific domain names (they are unique for an every package) which differ from the main domain name that is used for own custom pages. Example of a page from the "mea" package:

Since an own page is not a part of this package, a relative URL does not work, because it's equal to the following absolute URL:

So, does anybody know what SF configurations may affect this? Why does SF use absolute URLs in the most of orgs and relative URLs sometimes in several orgs? I tried to reproduce this issue in our dev org, but didn't succeed.
NagendraNagendra (Salesforce Developers) 
Hi Gennadly,

A URL specifies the location of a target stored on a local or networked computer. The target can be a file, directory, HTML page, image, program, and so on. 

Absolute URL
In addition to several other meanings, the word absolute, in English, means “not dependent on anything else“. It also means “free from doubt“.
An Absolute URL is, thus, something that is independent or free from any relationship. When you use an absolute URL, you point directly to a file. Hence, an absolute URL specifies the exact location of a file/directory on the internet. It also follows that each absolute URL is unique, which means that if two URLs are identical, they point to the same file.

For example specifies an image fileemail.gif located in the images directory, under domain name.
Similarly, the absolute URL of the document you are viewing is relative_and_absolute_urls.php3which is a page in the directory called design on this website.

Relative URL

A relative URL points to a file/directory in relation to the present file/directory.
Let us understand relative URLs through a small exercise.
Look at the two URL above. We want to include (display) the image file email.gifstored in the images directory of domain on this (relative_and_absolute_urls.php3 stored in the design directory) page.

There are two ways to do this. We can either refer to it using an absolute URL or use a relative URL. The <img> tag for this image display will be as follows:

Using an Absolute URL in an <img> tag
<img src=""
width="..." height="..." />

Using a Relative URL in an <IMG> tag
<img src="../images/email.gif" width="..." height="..." />

When to use Absolute and Relative URL :

When requesting external resources, you most likely want to use a URL relative to the scheme (unless you want to force a different scheme ) and when dealing with local resources you want to use relative URLs based on the document root.
<!DOCTYPE html>
        <link href='//,700italic,300,700' rel='stylesheet' type='text/css'>
        <link href="/style/style.css" rel="stylesheet" type="text/css" media="screen"></style>
        <img src="/images/some/localimage.png" alt="">
        <script src="//" ></script>

I have always preferred relative URLs as they help in website maintenance. Also, it’s easy to transfer a website from one domain name to another. If you had used absolute URLs in all links and SRC attributes, you’d have a difficult time updating each link on each page. With the use of relative URLs, you have no such problems. Also, relative URLs would be shorter than absolute URLs and hence the file size of the web page would reduce (click know more about optimizing web pages) if you use the former.
Absolute URLs too have their advantages and are especially helpful, if you want to plan to shift a page on your website from one directory location to another. (I am not sure why you would want to do this, but if you do, absolute URLs would be helpful in such cases).

Finally, It  was never  known of any server performance benefits with the use of a particular URL type.

Please accept my solution as best answer if my solution was helpful. 

Best Regards
Hi Nagendra.P. Thank you for your response, but this information is not useful for me. Purposes of different types of URLs are obvious for developers.

What is not clear for me: why does Salesforce always use absolute URLs for VF homepage components in the most of orgs, but use relative URLs for the same components in few other orgs?

In terms of what you said, relative URLs are not correct for these components if you open a page that belong to a package. URLs of such pages are based on another domain name rather than URLs for custom VF pages (that are referred in homepage components). As a result, browser tries to find my own custom page in a package and, of course, this action fails. So, homepage components, which refer to custom pages, fail.

I would like to know whether this is a defect in Salesforce or there is a configuration parameter that affects this or something else.