0

I am fetching the value of wesite field from account i want to redirect to site when user clicks on the link. But am not redirected to the external url instead of that salesforce is appending its org url in fron of eg: https://dev-pretestorg.force.com/www.google.com.

I also tried to use anchor tag and both are working in the same way. I also tried with java script its also not redirecting to external site. Can any one suggest me how to redirect to external site.

3
  • Can you please show us some of the code for things you have tried?
    – Dominic
    Commented Dec 19, 2014 at 9:39
  • <a href="{!item.Website}" target="_blank" >{!item.Website}</a>
    – Monish
    Commented Dec 19, 2014 at 9:40
  • Have you tried this: <apex:outputField value="{!item.Website}" /> oops, that doesn't open in a new window...
    – Dominic
    Commented Dec 19, 2014 at 10:09

1 Answer 1

0

Salesforce stores the website value as an address only, without the protocol. When it outputs the value as an <apex:outputField /> it builds the link including protocol. You will need to add the protocol yourself as you are building the link yourself. I assume the reason you are building your own link is to get the target="_blank". So you can do:

<a href="http://{!item.Website}" target="_blank" >{!item.Website}</a>

or

<apex:outputLink value="http://{!item.Website}" target="_blank" >{!item.Website}</apex:outputLink>

You must log in to answer this question.

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