Last active
November 1, 2017 07:09
-
-
Save nag4/c6e0200bc5f5f26a25d9b03836b9a3ad to your computer and use it in GitHub Desktop.
SafeFrame ver1.1 仕様読解、媒体側の実装例 ref: http://qiita.com/nag4/items/de044690dd227865a134
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
<iframe id="ad" src="http://secondary-domain.com/hoge.html"> | |
// 広告コンテンツをここに展開する。 | |
// secondary-domain.com のiframe なので、 | |
// クロスドメイン制約によりiframeの外のbaitai.comにはアクセスできない。 | |
</iframe> |
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
<script src="http://SecondaryHost.com/path-to-SF-resources/1.1.0/js/lib/base.js"></script> | |
<script src="http://SecondaryHost.com/path-to-SF-resources/1.1.0/js/host/host.js"></script> | |
<script src="http://SecondaryHost.com/path-to-SF-resources/1.1.0/js/lib/boot.js"></script> | |
<script type="text/javascript"> | |
(function() { | |
var conf = new $sf.host.Config({ | |
renderFile: "http://SecondaryHost.com/path-to-SF-resources/1-1-0/html/r.html" | |
}); | |
})(); | |
</script> |
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
// 広告を表示する位置を示すdivタグ | |
<div id="leaderboard"> | |
</div> | |
// "x-safeframeタグ" | |
<script type='text/x-safeframe' class='sf_data'> | |
{ | |
"id" : "leaderboard_src", | |
"src" : "http://ad.delivery.com/path-to-creative/sample.js",// クリエイティブへのURL | |
"conf" : // この conf は、sf.host.PosConfig のフィールドに対応している | |
{ | |
"size" : "728x90", | |
"z" : "1"// z-index値 | |
"dest": "leaderboard",// divタグのIDを指定する | |
"supports" : {// 全て明示的に OFF にしています | |
"exp-ovr" : "0", | |
"exp-push" : "0", | |
"read-cookie" : "0", | |
"write-cookie" : "0" | |
} | |
} | |
} | |
</script> |
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
|--html | |
| |--r.html | |
|--js | |
| |--ext | |
| | |--ext.js | |
| |--host | |
| | |--host.js | |
| |--lib | |
| | |--base.js | |
| | |--boot.js | |
| | |--proxy.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment