Created
October 27, 2017 10:07
-
-
Save ps-team/e70337ed5a5fcc281c3abca00a7c8b96 to your computer and use it in GitHub Desktop.
Append stylesheet to iframe contents (e.g. Twitter widget) - this is filthy, but it works well when no other option is available.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
setTimeout(function() { | |
var iframe = document.getElementsByTagName('iframe')[0], | |
iframeDoc = iframe.contentWindow.document; | |
var otherhead = iframeDoc.getElementsByTagName("head")[0]; | |
var css = document.createElement("link"); | |
css.type = "text/css"; | |
css.rel = "stylesheet"; | |
css.href = "/SiteElements/Stylesheets/twitter-widget.css"; | |
otherhead.appendChild(css); | |
}, 500); | |
}); |
I would like to say thanks also... saved a lot of time
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From the depths of the internet, and on behalf of others who learnt from this without saying anything, thank you.