Auto-resize breaks JavScript in the iframe
-
I have the auto-resize working, with the iframe content provided by an app on another domain. The content is a form with a number of dynamic elements and bootstrap. The dynamic elements include re-populating select lists, showing and hiding fields and some AJAX and jQuery.
Without the auto-resize JavaScript included, it words fine in an iframe, although having to set a massively high iframe (we want to avoid scrollbars) is not very helpful.
The form, when run outside of the iframe, works fine whether the auto-resize JavaScript is in or not.
However, run in an iframe, with the auto-resize javascript, the form breaks. A JS error means that JS halts and no JS then runs on the form.
Here is our tag:
[advanced_iframe securitykey="xxxxxxxxxxxxe4e3789e426bba4dxxxxxxxxxxxx" src="https://www.mysite.co.uk/myform" resize_on_ajax="100" resize_on_click="100" onload_resize_width="false" onload_resize="false" onload=""]
Here is the JS error we are seeing on loading the iframe:
Error: Permission denied to access property 'document' https://main-site.com/test-page/ Line 185
Line 185:
<script> function ai_jquery_ajax_resize_advanced_iframe() { jQuery("#advanced_iframe").bind("load",function(){ vvvvvvvvvvvvvvvvvvvv doc = this.contentWindow.document;doc.addEventListener("click", function(evt) { if (checkIfValidTarget(evt,"a")) { local_resize_advanced_iframe(100); }}, true);}); ^^^^^^^^^^^^^^^^^^^^ }ai_jquery_ajax_resize_advanced_iframe();</script><script> var send_advanced_iframe = ifrm_advanced_iframe.contentWindow.XMLHttpRequest.prototype.send, onReadyStateChange_advanced_iframe;
- The topic ‘Auto-resize breaks JavScript in the iframe’ is closed to new replies.