4

I have a visualforce page and a controller for it, already written. My requirement is to show the same page as one of the homepage components in the left sidebar, I did that by calling through an iframe, till now all working fine. When any page will get loaded, I want the url of the page not of the visualforce page which I have created. eg.'https://na12.salesforce.com/001/o' or 'https://na12.salesforce.com/home/home.jsp' but not the one like '/apex/mypagename'.

How to achieve this ?

<iframe src="/apex/HomePageComponent?core.apexpages.devmode.url=1" id="showskill" frameborder="0" height="100px" width="180px"> </iframe>

this is my iframe code, I want something like where I can pass a string, appending it to src probably this way, '/apex/mypage?id='+var

3
  • You can definitely pass parameters to that URL but what type of parameters you want to pass? From where would be getting them?
    – PepeFloyd
    Sep 13, 2012 at 8:33
  • parameter would be some what like this '/apex/mypage?id='+var where var being a javaScript variable, and i would be fetching it from vf page's controller. Sep 13, 2012 at 8:44
  • @priyanka, m sorry but ur URLencode didn't work for me:( thanks though. Sep 14, 2012 at 7:20

2 Answers 2

4

I managed to find the answer with the help of one of my friends, it was simple but really hard to find.

<iframe src="/apex/HomePageComponent?core.apexpages.devmode.url=1" id="showskill" frameborder="0" height="100px" width="180px"> </iframe>

I was doing the same stuff earlier also.. just found out something called Frame[0].location which helped me achieve the desired reqmnt.

<script> 
    var location = window.location;  
    var static_location = "/apexHomePageComponent?core.apexpages.devmode.url=1&src="; 
    var abs_url = static_location + location; 
    frame[0].location = abs_url; 
</script>

Now, from the Vf page's controller i can fetch the value of 'src' quite easily

Thank you so much Vishal for this. :)

1
  • Please select this answer to close the question.
    – Saariko
    Oct 21, 2012 at 8:40
0
<iframe src="/apex/HomePageComponent?core.apexpages.devmode.url=1" id="showskill" frameborder="0" height="100px" width="180px"/> 
<script> 
    var location = window.location;  
    var static_location = "/apexHomePageComponent?core.apexpages.devmode.url=1&src="; 
    var abs_url = static_location + location; 
    frame[0].location = abs_url; 
</script>

You must log in to answer this question.

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