SlideShare a Scribd company logo
1 of 23
Download to read offline
現状最強のIFrame
DynamicasyncFriendlyIFrameの話
みんな広告嫌いだよね?
画面が占領されて邪魔
押し間違い
不快な広告
ウザい広告1:オーバレイ広告
上から下に降りてきて最下部に固定される
押し間違いや閲覧の邪魔に
ウザい広告2:遅延挿入型のバナー広告
ヘッダー等に後から挿入される
ヘッダーを押そうとして押し間違いが起こってウザい
こういった広告は、主に二つの方法で挿入さ
れている
1.scriptタグによるDOM操作
2.IFrameによるサードパーティコンテンツの呼び出し
1.scriptタグによる実装例
広告を挿入するためのscriptタグ
<script src="https://ads.js"></script>
//ads.jsのコード
docment.write('広告のDOM');
1.scriptタグによる実装の利点
実装がとても単純
サードパーティー側(広告配信業者)が親ページの情報
を取得できる
ユーザーに合わせた広告が出せるように
1.scriptタグによる実装の欠点
レンダリングをブロックしてしまう
onload のタイミングにも影響
サードパーティー側がDOMをいじれる
強制リダイレクト
cookie情報の流出等のセキュリティリスク
2.IFrameによる実装例
広告を挿入するためのiframeタグ
<iframe src="https://ads.html"></iframe>
2.IFrameによる実装の利点
非同期で読み込めるので、レンダリングをブロックし
ない
サードパーティー側の介入を受けない(同一ドメイン
制約)
サードパーティー側にDOM操作される心配ない
cookie盗まれる心配ない
2.IFrameによる実装の欠点
IFrameの内と外でドメインが違う
サードパーティー側がページの情報を取得できない
広告の最適化ができない
iframe自身の操作が面倒(高さ調節とか)
サードパーティー側の対応が必要
まとめると・・・・
scriptタグ IFrame
広告の最適化 ○ ✖ 
セキュリティ ✖  ○
レンダリングへの影響 ✖  △
実装コスト ○ △
scriptタグによる実装
広告の最適化は可能だが、親ページへの悪影響を与える可能性
IFrameによる実装
親ページへの悪影響はないが、広告の最適化ができない
これを解決するためのソリューションが・・・
FriendlyIFrame(通称FiF)
FriendlyIFrameの実装方法
src属性をabout:blankにしたiframeを動的に生成
サードパーティのコードを呼び出すscriptタグを
iframe内に設置
inDapIF=trueというフラグをiframe内に作る
<iframe src="about:blank">
<html>
<head></head>
<body>
<script src="https://ads.js"></script>
<script>inDapIF = true</script>
</body>
</html>
</iframe>
FriendlyIFrameとその他方式の比較
scriptタグ IFrame FriendlyIFrame
広告の最適化 ○ ✖  ○
セキュリティ ✖  ○ ✖ 
レンダリングへの影響 ✖  △ △
実装コスト ○ △ ✖ 
FriendlyIFrameの中身は同一オリジンなので、親ペ
ージにアクセス可能
FriendlyIFrameはIFrameの一つなので、非同期で読
み込める
IFrame/FriendlyIFrameの弱点1
レンダリングへの悪影響がないわけではない
例えば・・・
親サイトのonloadイベントが遅れる
IFrameのonloadイベントが全て終わってから、
親ページのonloadイベントが発生
全てのonloadイベントが終わるまでブラウザイ
ンジゲーターが回り続ける
これを解決するためのソリューションが・・・
DynamicAsyncIFrame(DAiF)
DynamicasyncIFrameの実装
srcを空にしたIFrameを設置しておく
IFrameのonloadイベントを上書きして、onloadイ
ベントの中でサードパーティーのスクリプトタグを挿
入する
<iframe src="" id="frame"></iframe>
<script>
const ifrm = getElementById("frame");
ifrm.contentWindow.document.open().write('<body onload="'
'var d = document;d.getElementsByTagName('head')[0].' +
'appendChild(d.createElement('script')).src' +
'=広告のURL">');
</script>
DynamicasyncIFrameを他の手法と比較
scriptタグ IFrame FiF DAiF
広告の最適化 ○ ✖  ○ ✖ 
セキュリティ ✖  ○ ✖  ○
レンダリングへの影響 ✖  △ △ ○
実装コスト ○ △ ✖  △
DynamicasyncIFrameはIFrameのonloadイベントが
終了してからIFrameの中身を読み込むので、親ページの
onloadを妨げない
そして、FiFとDAiFの合わせ技が・・・
最強のIFrame
DynamicasyncFriendlyIFrame(DAFiF)
他の手法との比較
scriptタグ FiF DAiF DAFiF
広告の最適化 ○ ○ ✖  ○
セキュリティ ✖  ✖  ○ ✖ 
レンダリングへの影響 ✖  △ ○ ○
実装コスト ○ ✖  △ ✖ ✖ 
セキュリティ面以外は最強(ただし実装コスト・・・)。
現状最強の広告表示IFrame
DynamicasyncFriendlyIFrameの話
終わり
おまけ
真に最強のIFrame
DynamicasyncSafeFrame(DASF)
scriptタグ FiF DAiF DAFiF DASF
広告の最適化 ○ ○ ✖  ○ ○
セキュリティ ✖  ✖  ○ ✖  ○
レンダリングへの影響 ✖  △ ○ ○ ○
実装コスト ○ ✖  △ ✖ ✖  ✖ ✖ ✖ 

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Dynamic async Friendly IFrameの話