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
Attribution to: mystery_mac
Possible Suggestion/Solution #1
<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>
Attribution to: James
Possible Suggestion/Solution #2
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. :)
Attribution to: mystery_mac
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1411