0
|
1 <!DOCTYPE html>
|
|
2 <html>
|
|
3 <head>
|
|
4 <meta charset="utf-8">
|
|
5 <title>iFrame message passing test</title>
|
|
6 <meta name="description" content="iFrame message passing test">
|
|
7 <meta name="viewport" content="width=device-width">
|
|
8 <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
9 <script type="text/javascript">
|
|
10 //MDN PolyFil for IE8 (This is not needed if you use the jQuery version)
|
|
11 if (!Array.prototype.forEach){
|
|
12 Array.prototype.forEach = function(fun /*, thisArg */){
|
|
13 "use strict";
|
|
14 if (this === void 0 || this === null || typeof fun !== "function") throw new TypeError();
|
|
15
|
|
16 var
|
|
17 t = Object(this),
|
|
18 len = t.length >>> 0,
|
|
19 thisArg = arguments.length >= 2 ? arguments[1] : void 0;
|
|
20
|
|
21 for (var i = 0; i < len; i++)
|
|
22 if (i in t)
|
|
23 fun.call(thisArg, t[i], i, t);
|
|
24 };
|
|
25 }
|
|
26 </script>
|
|
27 <style>
|
|
28 *, *:before, *:after {box-model: border-box;}
|
|
29 a { float:right; margin-left:10px;}
|
|
30
|
|
31 h2 {margin-top: 0;}
|
|
32 </style>
|
|
33 </head>
|
|
34 <body>
|
|
35 <h2>Nested iFrame</h2>
|
|
36 <p>Resize window or click one of the links in the nested iFrame to watch it resize.</p>
|
|
37 <div style="margin:20px;">
|
|
38 <iframe id="nestedIFrame" src="frame.content.html" width="100%" scrolling="no"></iframe>
|
|
39 </div>
|
|
40 <p id="callback">
|
|
41 </p>
|
|
42
|
|
43 <script type="text/javascript" src="../../js/iframeResizer.contentWindow.min.js"></script>
|
|
44 <script src="jquery.js"></script>
|
|
45 <script type="text/javascript" src="../../js/iframeResizer.min.js"></script>
|
|
46 <script type="text/javascript">
|
|
47
|
|
48 iFrameResize({
|
|
49 log : true, // Enable console logging
|
|
50 resizedCallback : function(messageData){ // Callback fn when message is received
|
|
51 setTimeout(function(){parentIFrame.sendMessage('nested')},50);
|
|
52 }
|
|
53 });
|
|
54
|
|
55
|
|
56 </script>
|
|
57
|
|
58 </body>
|
|
59 </html> |