Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter URI resolver (t.co links)
var linksLength = document.getElementsByClassName("twitter-timeline-link").length;
for (var i = 0; i < linksLength; i++) {
var link = document.getElementsByClassName("twitter-timeline-link")[i];
if (link.getAttribute("data-ultimate-url"))
link.setAttribute("href", link.getAttribute("data-ultimate-url"));
else
link.setAttribute("href", link.getAttribute("data-expanded-url"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.