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
lavanya gottumukkalalavanya gottumukkala 

Converting HTML Area home page component to Visualforce Area Component

Hi,
   I have created an HTML Area component to Hide the side bar in home page.Now I am tyring to convert that into visualforce area component by coping code from HTML area to <apex:page>HTML</apex:page> tag.It's not working.Please see the below code from HTML component and tell me how to convert that into visualforce area effectively.

<script>document.getElementById("sidebarDiv").style.display='none';</script><style>.outer td.oRight {padding-left:0px;}.outer td.oRight {background-color:#FFFFFF;padding:0 ;}</style>
 
bob_buzzardbob_buzzard
What do you mean by "its not working".  Visualforce will allow JavaScript in the page, so there's nothing wrong with that.  If you are hoping for this JavaScript to be able to access the DOM of areas outside the Visualforce component, you are out of luck I'm afraid - the browser's same origin policy will block that, as Visualforce comes from a different server to the standard page elements.
lavanya gottumukkalalavanya gottumukkala
Hi Thanks for the update. We have HTML Area components in our org.After Summer '15 release, “Home Page Custom Components” contains JavaScript or other advanced HTML elements will no longer supported.So we need to convert all HTML Area components into Visualforce Area. For better understanding, we have HTML component with 'Show HTML' option and below is the code. .outer td.oRight {padding-left:0px;}.outer td.oRight {background-color:#FFFFFF;padding:0 ;} We are trying to convert it into Visual Force Area Component.For that,we created below page. .outer td.oRight {padding-left:0px;} .outer td.oRight {background-color:#FFFFFF;padding:0 ;} Please let me know if you need more details regarding this. Thanks in advance.
bob_buzzardbob_buzzard
I think I have all the detail that I need - you are trying to replicate an HTML Area component that accessed the DOM of standard pages. You can't do that any more, not with Visualforce Area components or HTMLArea components. Salesforce have stopped you doing this intentionally, so there's no workaround.
lavanya gottumukkalalavanya gottumukkala
Hi thanks for your quick response. I think you understood what we are trying to do and said there is no work around for this.As per the below link https://help.salesforce.com/apex/HTViewSolution?urlname=Home-Page-Components-Changes-Starting-Summer-14& by end of the June15 salesforce is going to remove all the unsupported code like JavaScript from HTML Area components. But,we have existing HTML Area components configured in the client orgs.How would be the behaviour of these existing components? They will work properly or there will be any changes in the behaviour of these components after June 2015. Thanks & Regards,
Shailesh Bhirud 10Shailesh Bhirud 10
Hi lavanya,
Did you finish converting your HTML Area home page component to Visualforce Area Component successfully? if yes please share how you did it? Also if possible share the code.

Thanks.