Problem redirecting to the self.location (inside iframe) after tweeting


#1

I am trying to use the Web Intents Javascript Events (https://dev.twitter.com/docs/intents/events) to redirect my users to another page after they tweet using the tweet button provided.

The thing is, the tweet button is inside an iframe, and I could not get it to redirect to the desired page. Note: the redirection is supposed to happen inside the iframe too.

Here is what I got for now

the iframe in the parent page (which is the iframe containing the tweet button) is already labeled by id=“main”, but it doesn’t work. I tried self.location.href=‘http://www.google.com’ too.

Is there anyway to make this work? Am I doing anything wrong here? I’m pretty much a newbie with Javascript. I would be very glad if anyone could give me the solution, or even pointers :slight_smile:

Thank you in advance, I’d very much appreciate your help.


#2

anyone could help me with this? even any tips/clues would do :slight_smile:


#3

When the tweet event occurs, we provide access to the iframe that the event originated at:

twttr.events.bind('tweet', function (event) { event.target.src = "http://google.com"; });

This should do the trick. Let me know if it works!


#4

#5