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
Josh HarshJosh Harsh 

How to create a visualforce page to display the website linked to an Account?

I am trying to develop a visualforce page that allows a user to see the Companies Website without having to leave the Account page. Is this possible?
RishavRishav
hi josh,
               try this code
 
<apex:page standardController="Account">
<apex:form >
<div>
<a href="{!Account.website}" target="_top">
{!Account.website}
</a>
</div>
</apex:form>
</apex:page>


Now pass the id of any your account as query string in your address bar like this
https://rishav.ap1.visual.force.com/apex/try2?id=0019000000y1NiP

if you get your solution mark it as best answer.

Thanks
Rishav

Josh HarshJosh Harsh
Rishav

I am unable to view https://rishav.na8.visual.force.com/apex/try2?id=0019000000y1NiP due to it being a seperate Salesforce instance. Do you have a different way that I can view it?
RishavRishav
Hi john,
                    i had not told you to try my link but instead of this try this in your org.
                   1.open your developer console and make a new visualforce page, remove your existing code and paste this above code.
                    2. now take any acoount id from your org 
                     3. add  that accountId int the browser address bar    ?youraccountId
Thanks
Rishav
Josh HarshJosh Harsh
OK, I followed those steps but it only showed the Website link. I was trying to get it to actually show the webpage on the Accounts page.
RishavRishav
you click on the link and it will open  the webpage.

or do you want to open this link automatically?
Josh HarshJosh Harsh
My hope was to be ablle to see the Webpage right within salesforce. Basically have it as a window on the Account page. If that makes sense.
RishavRishav
okay then you can do some experiment with the target attribute. Make a block on your page give it to some id and  in target attribute  give the id of that block, like this target="blockId".

i told you to do experiment because which property will work within salesforce never be guarranted because they have their own styling and all .so just do some experiment.
Thanks
Rishav 
Josh HarshJosh Harsh
OK so this is what I have set up:

<apex:page standardController="Account">
<apex:form >
<div>
<a href="{!Account.website}" target="_self">
{!Account.website}
</a>
</div>
</apex:form>
</apex:page>

The thing is it is adding the Salesforce URL infront of the actual web page. Is there a way to remove that piece of the URL?
RishavRishav
salesforce is having very unpredictable behaviour with HTML  and Css attributes sometime.
Hey what's problem if user will have to click back button once according to my solution. i also tried in many ways but not coming.

Josh HarshJosh Harsh
The goal would be if we can get this to work to just instruct them to always navigate through the website if the need to go back they will have to navigate back to that point. It is just going to be used as a quick reference and it is just easiest if they do not have to leave the Salesforce window.
RishavRishav
okay then do some research on it and find out solution.
Best of Luck

Thanks
Rishav