Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Documentation says I can choose an HTML file for header image in Customer Portal. Searching on the internet is showing that people have uploaded the image on Documents, and referring to the ID of this Document image in their HTML file. This means that after deployment, I will have to manually change the ID in my HTML file. I want the solution to be sustainable, i.e., no maintenance should be needed after deployment. Is there a way to add an image banner without using ID?

Can you provide me the snippet of HTML code?

Edit: In case I use Header Logo field in Customer Portal, the image will get scaled down to 300px width, like the screenshot below. Hence I can't use this approach if I have to add a Customer Portal image banner covering full width of the page, just above the tabs. Also, in case of using Logo field, the image will have to be less than 20 KiB.

enter image description here

share|improve this question
    
I am not sure why you want to add as html .Please see my answer .You can change the header logo as needed . –  Mohith Kumar Feb 12 '13 at 8:37
    
@MohithKumar, I can't use logo field, because image logos are getting scaled down to 300px width. Hence I can't use this approach if I have to add a Customer Portal image banner covering full width of the page, just above the tabs. Also, in case of using Logo field, the image will have to be less than 20 KiB. –  Suman Krishna Saha Feb 12 '13 at 8:48
    
.I see .Upvoting the question and deleted my answer .Also mention these points in question so that the question is crystal clear!Cheers! –  Mohith Kumar Feb 12 '13 at 8:49
    
@MohithKumar, thank you for your suggestion. I have mentioned these points in my question and added a screenshot of why I cannot use header logo field. –  Suman Krishna Saha Feb 12 '13 at 8:54
    
Excellent!This will give better understanding and also ensure you will get proper response and suggestions –  Mohith Kumar Feb 12 '13 at 9:00
add comment

2 Answers

up vote 3 down vote accepted

This will smell horrendous but I'm guessing you want HTML in the portal header for good reason ;-)

Upload it as a Static Resource and use JavaScript UserContext.siteUrlPrefix to resolve the path:

<script type="text/javascript">
  document.write(
    "<img " +
      "src='" + UserContext.siteUrlPrefix + "/resource/yourImagePng'" +
    "/>"
  );
</script>
share|improve this answer
    
Nope, not working. I don't think that UserContext can work in non-VF HTML pages. –  Suman Krishna Saha Feb 12 '13 at 9:05
    
It'll only work in a Force.com Site or Customer Portal via your HTML header. If you inspect the DOM, what is the URL that ends up in your img tag? –  user320 Feb 12 '13 at 9:42
    
Hey @BarneyRubble, that's JavaScript, not Visualforce - please try again carefully. –  user320 Feb 12 '13 at 10:27
2  
Thank you for stubbornly sticking around! It works perfectly. Since this functionality is undocumented and in case Salesforce changes the URL for accessing Static Resources later, do you see any issues in the future? –  Suman Krishna Saha Feb 12 '13 at 10:40
    
:-) maybe take a look at Chatter Communities which offers better customization options –  user320 Feb 12 '13 at 12:28
add comment

In my case it also worked without the siteUrl prefix (and adherent javascript). So I just put:

<link href="/resource/PartnerPortalAssets/style.css" rel="stylesheet">

for my css file

which would translate to:

<img src="/resource/yourImagePng" />

for your image

share|improve this answer
    
nice - simpler is always better, just note it won't work on any Site with a Name... –  user320 Nov 28 '13 at 16:57
    
good point! Also on Communities this might not work. –  guy Nov 29 '13 at 18:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.