i'm trying to reproduce the recommend button of facebook especially the sort of tooltip which appear on the host page.
May be that out of my competence but i'd like to understand how FB do that.
They implement an iframe with the Recommend button. When you click on, you got a kind of tooltip (simples div) that goes over the host page.
I'm trying to do the same but of course, i cannot show content out of the iframe !
Here is some sample of my code (hostingdomain.org) :
<script type="text/javascript">
(function() {
id_marchand = 'daL/RqzZcfqc.';
var tyd = document.createElement('script');
tyd.type = 'text/javascript';
tyd.async = true;
tyd.src = 'http://mydomain.fr/tyd//module/pro_mod.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(tyd, s);})
();</script>
The goal of this script is to read some content on the host page then send it via postMessage to that iframe :
<iframe src="http://multipress.fr/tyd//module/pro_mod.php"
height="50px" width="150px"
name="tyd_frame" id="tyd_frame" style="border:1px solid black;"
onload="start_tyd();"></iframe>
it that iframe i receive the message content then apply function on it. I used an iframe because i needed to read cookie from mydomain.fr to execute my stuff.
Now i want to make appear a tooltip (or extradiv) to confirm at the user that it's complete. But i cannot make anything appear out the iframe...For security reason i'm sure but Facebook does it !
So the solution i'm working on is to use again postMessage in the iframe to send back content to pro_mod.js which can work on the host page but i don't find how to do that.
Thanks for your help !