annotate iframe-resizer/example/frame.nested.html @ 7:0f2b740536fb draft

Uploaded
author saskia-hiltemann
date Mon, 21 Aug 2017 09:16:07 -0400
parents ac5f9272033b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 <!DOCTYPE html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 <html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 <head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 <meta charset="utf-8">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 <title>iFrame message passing test</title>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 <meta name="description" content="iFrame message passing test">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 <meta name="viewport" content="width=device-width">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 <meta http-equiv="X-UA-Compatible" content="IE=edge">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 <script type="text/javascript">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 //MDN PolyFil for IE8 (This is not needed if you use the jQuery version)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 if (!Array.prototype.forEach){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 Array.prototype.forEach = function(fun /*, thisArg */){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 "use strict";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 if (this === void 0 || this === null || typeof fun !== "function") throw new TypeError();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 var
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 t = Object(this),
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 len = t.length >>> 0,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 thisArg = arguments.length >= 2 ? arguments[1] : void 0;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 for (var i = 0; i < len; i++)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 if (i in t)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 fun.call(thisArg, t[i], i, t);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 };
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 </script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 <style>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 *, *:before, *:after {box-model: border-box;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 a { float:right; margin-left:10px;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 h2 {margin-top: 0;}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 </style>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 </head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 <body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 <a href="frame.content.html">Back to page 1</a>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 <h2>Nested iFrame</h2>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 <p>Resize window or click one of the links in the nested iFrame to watch it resize.</p>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 <div style="margin:20px;">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 <iframe id="nestedIFrame" src="frame.content.html" width="100%" scrolling="no"></iframe>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 <p id="callback">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 </p>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 <script type="text/javascript" src="../js/iframeResizer.min.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 <script type="text/javascript">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 var level = document.location.search.replace(/\?/,'') || 0;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 $('iframe').attr('id','nestedIFrame'+level).attr('src','frame.content.html?'+level);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 iFrameResize({
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 log : true, // Enable console logging
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 enablePublicMethods : true, // Enable methods within iFrame hosted page
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 resizedCallback : function(messageData){ // Callback fn when message is received
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 $('p#callback').html(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 '<b>Frame ID:</b> ' + messageData.iframe.id +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 ' <b>Height:</b> ' + messageData.height +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 ' <b>Width:</b> ' + messageData.width +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 ' <b>Event type:</b> ' + messageData.type
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 messageCallback : function(messageData){ // Callback fn when message is received
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 $('p#callback').html(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 '<b>Frame ID:</b> ' + messageData.iframe.id +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 ' <b>Message:</b> ' + messageData.message
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 alert(messageData.message);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 closedCallback : function(id){ /// Callback fn when iFrame is closed
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 $('p#callback').html(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 '<b>IFrame (</b>' + id +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 '<b>) removed from page.</b>'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 </script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 <script type="text/javascript" src="../js/iframeResizer.contentWindow.min.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 </body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 </html>