How to Embed Twitter in an Iframe
By Dan Stone
Twitter provides embedded widgets that inject Twitter content into an inline frame within another Web page through a script. Twitter's site blocks direct iframe display through the secure hypertext transfer protocol, which keeps someone from making a direct iframe to any given page on Twitter. Instead, Twitter widgets need to be created through the corresponding Twitter account to be embedded on a site within an iframe.
Pages Within Pages
Iframes are a feature within HTML that allows a Web developer to embed content from one website or Web page within another. Within HTML, there are other commands that can be used to create frames which divide a Web page into separately loading content: the iframe tag creates an enclosed frame. Twitter widgets use the iframe construct to display content that's hosted on Twitter within other websites to appear as if it is one cohesive Web page.
Twitter Iframe Widgets
Creating Twitter Widgets
To create Twitter widgets, log in to the Twitter site with your personal account, click the "gear" icon and select the "Settings" option. Choose the Widgets subheading from the left-side menu and click "Create new." Choose "User timeline," "Favorites," "List" or "Search" depending on which kind of module you want to create. To set up "User timeline" and "Favorites," enter the account user name and click "Create widget" to generate the widget code. To setup a "List" widget, select the already created list you want to use and click "Create widget." To create a search widget, enter the hashtag you want to list under the "Search Query" and click "Create widget."
Implementing Twitter Widgets
Embed Third-Party Tweets
You can generate embed codes for individual tweets from any account by using the "Embed" option. To use the tweet embed feature, go to the Twitter account's timeline page and locate the tweet you want to embed. Mouse over the tweet, click "More" and select "Embed Tweet." The site pops up a box containing the embed code, which can be copied and pasted to another site to display the tweet.
Dan Stone started writing professionally in 2006, specializing in education, technology and music. He is a web developer for a communications company and previously worked in television. Stone received a Bachelor of Arts in journalism and a Master of Arts in communication studies from Northern Illinois University.