Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
iframe: a less than useful look at the abuse th...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Remy Sharp
December 02, 2013
Technology
1.2k
8
Share
iframe: a less than useful look at the abuse the iframe takes
A 20 minute version for dotjs of my iframe abuse talk
Remy Sharp
December 02, 2013
More Decks by Remy Sharp
See All by Remy Sharp
How to fix a Game Boy
rem
0
41
Using a Modern Web to Recreate 1980s Horribly Slow & Loud Loading Screens
rem
0
190
Recreating the ZX Spectrum loader with Web APIs
rem
0
310
Living Standard
rem
1
350
State of the Gap
rem
1
930
The Art of Debugging
rem
2
2.3k
EdgeConf - Progressive Enhancement
rem
0
350
Toxic Side of Free. Or: how I lost the love for my side project.
rem
0
790
Muddling my way through real time
rem
0
800
Other Decks in Technology
See All in Technology
OCI技術資料 : 証明書サービス概要
ocise
1
7.2k
プロダクトを触って語って理解する、チーム横断バグバッシュのすすめ / 20260411 Naoki Takahashi
shift_evolve
PRO
1
130
TanStack Start エコシステムの現在地 / TanStack Start Ecosystem 2026
iktakahiro
1
320
ASTのGitHub CopilotとCopilot CLIの現在地をお話しします/How AST Operates GitHub Copilot and Copilot CLI
aeonpeople
1
180
ログ基盤・プラグイン・ダッシュボード、全部整えた。でも最後は人だった。
makikub
3
330
Network Firewall Proxyで 自前プロキシを消し去ることができるのか
gusandayo
0
200
ふりかえりを 「あそび」にしたら、 学習が勝手に進んだ / Playful Retros Drive Learning
katoaz
0
190
「決め方」の渡し方 / How to hand over the "decision-making process"
pauli
7
1.2k
機能・非機能の学びを一つに!Agent Skillsで月間レポート作成始めてみた / Unifying Bug & Infra Insights — Building Monthly Quality Reports with Agent Skills
bun913
5
3.3k
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.1k
"まず試す"ためのDatabricks Apps活用法 / Databricks Apps for Early Experiments and Validation
nttcom
1
170
仕様通り動くの先へ。Claude Codeで「使える」を検証する
gotalab555
8
2.6k
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
85
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.4k
ラッコキーワード サービス紹介資料
rakko
1
2.9M
We Have a Design System, Now What?
morganepeng
55
8.1k
Color Theory Basics | Prateek | Gurzu
gurzu
0
280
How to build a perfect <img>
jonoalderson
1
5.3k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
160
From π to Pie charts
rasagy
0
160
How GitHub (no longer) Works
holman
316
150k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
WENDY [Excerpt]
tessaabrams
9
37k
Transcript
<iframe> A less than useful look at the abuse the
iframe takes. Remy Sharp • @rem • Left Logic
2007: detect globals 2008: jsbin 2010: jsconsole 2011: responsivepx
2008: 1.jsbin.com
2010: 2.jsbin.com
2012: 3.jsbin.com
framesets
Amazingly still work! two frames side by side
document.body = frameset
Scott Isaacs @ Microsoft 1997
iframe support dropped in XHTML 1.1 Lack of <object> support
in IE7 meant iframes stuck around.
Foundation of early comet techniques 2000/2006 var iframe = document.createElement('iframe');
iframe.style.display = 'none'; document.head.appendChild(iframe); iframe.src = '/live-stream'; require('http').createServer(function (req, res) { res.writeHead(200, { 'content-type': 'text/html' }); res.write(sendPadding()); setInterval(function () { res.write(getLiveData()); }, 1000); });
iframe must be in DOM to start writing to it
var window = iframe.contentWindow || iframe.contentDocument.parentWindow;
function iframe() { var iframe = document.createElement('iframe'); document.body.appendChild(iframe); return iframe.contentWindow
|| iframe.contentDocument.parentWindow; } var window = iframe(), document = window.document; document.open(); document.write(myAwesomeHTML); document.close();
Load won't fire until .close is called - though content
loads
Take a generated iframe out of the DOM, it'll reset
Dynamic iframes don't behave like regular windows !
The "stick it in an iframe" bit
Auto-play! Missing <bgsound> on mobile? <iframe src="muzak.mp3"></iframe> iOS 4 only
:(
Site doesn't have JSON API? Put their HTML embed in
an iframe and scrape away!
Detecting globals
Mobile WebView (PhoneGap, Chrome for iOS, etc)
Click-jacking Watch out!
Preventable in IE9+ via X-Frame-Options: SAMEORIGIN
Damn you mobile version <meta name="viewport" ...>
"Damn flash-ad is showing through the dropdown!"
Sync loading can be offloaded to iframes, as it won't
block the parent frame.
Factory reset a Samsung S3? <iframe src="tel:*2767*3855%23"></iframe>
x-frame comms
For bi-directional non- sockets comms
Used in jsconsole's remote
your mobile site add <script> iframe origin: jsconsole.com jsconsole.com postMessage
& onmessage EventSource Ajax post
Set "base" origin via document.domain
iframe a.com – iframe b.com — iframe a.com Deep communication
http://bit.ly/cross-domain-barrier
Passing data before load event via: window.name
Sandboxing iframe return "clean" object
Enable appcache on unknown urls
•Request / == "app chrome" •All other urls include iframe
to light manifest page •Manifest says: FALLBACK: /* / •Therefore: any request to an unknown url, the "app chrome" will load via the fallback
Future / Now / Good Parts • postMessage/onMessage • seamless
• srcdoc • sandbox="allow-same-origin allow-forms allow-scripts" http://benvinegar.github.com/seamless-talk/
In the next episode: setTimeout! Remy Sharp • @rem •
Left Logic leftlogic.com/hiring