Detecting an embedded Tweet that's been deleted


#1

I’d rather not display an embedded Tweet that the user has deleted. The embed still looks OK without the avatar, date and intent links, but I assume it’s been deleted for a reason and the author would prefer that it not be displayed.

Is there a way using JavaScript to detect this condition and hide the embed?

I already have jQuery on the page, if that helps.


#2

Anybody?


#3

There’s no direct way that I know of to determine this from the embedded tweet experience itself. You can occasionally poll statuses/show for the tweet IDs you work with if you’d like to determine it that way. There is a call executed by our Javascript to statuses/show that tests the existence of the tweet but I’m not sure if you can trap that response reliably.


#4

Thanks Taylor. Really i don’t know much about JavaScript.

Inspecting an embedded Tweet that was deleted, it has a that is empty, while a ‘live’ Tweet has an image inside the span.

Is there not a JavaScript way of detecting this?


#5

If you want to rely on that field’s emptiness (though subject to change when markup on our side changes), that could be one way you could get the equivalent of this behavior – by using Javascript to test for the existence of content within span tags classed avatar within whatever containing DIV you put the embedded tweet within…


#6