|
26 | 26 |
|
27 | 27 | <div id=hdr> |
28 | 28 | <span id=allow-scripts class=radio> |
29 | | - <input type=checkbox> |
| 29 | + <input type=checkbox checked> |
30 | 30 | allow-scripts |
31 | 31 | </span> |
| 32 | + <span id=allow-modals class=radio> |
| 33 | + <input type=checkbox checked> |
| 34 | + allow-modals |
| 35 | + </span> |
| 36 | + <span id=allow-popups class=radio> |
| 37 | + <input type=checkbox checked> |
| 38 | + allow-popups |
| 39 | + </span> |
| 40 | + |
32 | 41 | <div style='flex:1'></div> |
33 | 42 | <button id=kill style='margin-right:20px'>kill</button> |
34 | 43 | </div> |
35 | 44 |
|
36 | 45 | <div id=hldr> |
37 | | - <iframe sandbox='allow-scripts allow-forms allow-popups allow-modals allow-downloads allow-pointer-lock allow-same-origin'></iframe> |
| 46 | + <iframe sandbox='allow-forms allow-downloads allow-pointer-lock allow-popups-to-escape-sandbox allow-same-origin'></iframe> |
38 | 47 | <div id=glass></div> |
39 | 48 | </div> |
40 | 49 |
|
|
95 | 104 |
|
96 | 105 | var hdr = $(shadow,'#hdr'); |
97 | 106 | chk['allow-scripts'] = $.chkbox(hdr,'#allow-scripts'); |
98 | | - console.log(chk); |
| 107 | + chk['allow-modals'] = $.chkbox(hdr,'#allow-modals'); |
| 108 | + chk['allow-popups'] = $.chkbox(hdr,'#allow-popups'); |
| 109 | + |
99 | 110 | $(hdr,'#kill').onclick = btn.kill; |
100 | 111 |
|
101 | 112 |
|
|
149 | 160 |
|
150 | 161 | var attr = iframe.getAttribute('sandbox'); |
151 | 162 | var tokens = new Set(attr.split(/\s+/).filter(Boolean)); |
| 163 | + |
152 | 164 | if(chk['allow-scripts'].checked){ |
153 | 165 | tokens.add('allow-scripts'); |
154 | 166 | } |
| 167 | + if(chk['allow-modals'].checked){ |
| 168 | + tokens.add('allow-modals'); |
| 169 | + } |
| 170 | + if(chk['allow-popups'].checked){ |
| 171 | + tokens.add('allow-popups'); |
| 172 | + } |
| 173 | + |
155 | 174 | var attr = [...tokens].join(' '); |
156 | | - console.log(attr); |
| 175 | + console.log(attr); |
157 | 176 | iframe.setAttribute('sandbox',attr); |
158 | 177 |
|
159 | 178 | iframe.srcdoc = html; |
|
0 commit comments