Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Problems with ajax inside iframe - collapses content
https://www.tinywebgallery.com/forum/viewtopic.php?f=21&t=5715
Page 1 of 1

Author:  Asle [ 30. Jan 2019, 17:29 ]
Post subject:  Problems with ajax inside iframe - collapses content

I am including an iframe and it shows up ok on first load. I have a table at the bottom (jquery DataTable) and when I click on a row I replace the content of the top DIV. The problem is that when the top DIVs content is replace, the table and everything under is hidden. In the source code it it is there but I can not see it anymore. Seems the IFRAME is collapsed. Is there any way I can fix this?

Here is my page: https://biofokus.no/narin2/ and if one clicks on a table row, the page collapses.

Author:  TinyWebGallery [ 30. Jan 2019, 18:28 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

you get errors in the iframe:

The configuration of "resize_on_element_resize" is invalid. The specified element #frame-content could not be found. Please check your configuration. If your content is loaded dynamically please specify onload_resize_delay with a time that is longer then your content needs to load!
3ai_external.js?vs=38:594 The configuration of "element_to_measure" is invalid. The specified element frame-content could not be found. Please check your configuration. As fallback "default" is used which measures the first child of the body.

can you please first not use this feature! because it seems this is my testdata #frame-content

remove #frame-content from the resize on element resize in the administration and save again.
The try #ai_wrapper_div
This is my wrapper which was added. So this is in the page ;).

So first make sure that this does not happen because of the ajax in the iframe...

Best, Michael

Author:  Asle [ 30. Jan 2019, 22:58 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

Thanks Michael!

First I went through the page and checked every single tag, specially the <DIV> tags if they were closed. Sure enough my top DIV that I replace content with ajax was not closed properly. So that at least made the ajax load work without cutting the page. I must have removed the specific DIV "frame-content" so I saw in the Chrome console that it was complaining it was missing.

Then I tried your suggestion removing it from administration and then adding #ai_wrapper_div in administration. Everything seems to work fine now, also on ajax resize in the frame.

Does this code look correct now for the iframe shortcode?

Code:
[advanced_iframe use_shortcode_attributes_only="true" src="https://narin.biofokus.no/indexbio_sa.lasso" id="narinbio" enable_responsive_iframe="true" enable_external_height_workaround="true" width="100%" height="800" url_forward_parameter="ALL" add_iframe_url_as_param="remote" resize_on_element_resize="ai_wrapper_div" enable_ios_mobile_scolling="false" scrolling="no"]


Thanks again Michael for your fast reply and great help!

Author:  TinyWebGallery [ 30. Jan 2019, 23:34 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

you can remove resize_on_element_resize="ai_wrapper_div" enable_ios_mobile_scolling="false" from the shortcode.
resize_on_element_resize is for the same domain but not used because you have set enable_external_height_workaround="true".
And enable_ios_mobile_scolling="false" is the default.

Best, Michael

Author:  Asle [ 31. Jan 2019, 14:17 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

Thanks. When I removed the "element_to_measure" value I get this error lots of times in console. Is it working or is this just an error I can ignore?

Code:
The configuration of "element_to_measure" is invalid. The specified element  could not be found. Please check your configuration. As fallback "default" is used which measures the first child of the body.

Author:  TinyWebGallery [ 31. Jan 2019, 19:09 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

this is not good. What have you set at element to measure? normally default is not the worst idea...

Author:  Asle [ 31. Jan 2019, 21:28 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

You mean to leave element to measure blank? I tried this and that is when I get the error message.

Author:  TinyWebGallery [ 1. Feb 2019, 00:00 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

no - "default" is the default. so simply use this.

Best, Michael

Author:  Asle [ 1. Feb 2019, 16:09 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

I entered "default" in the "element to measure" field in administration. It seems it stopped complaining now.

But I wonder if something is wrong with my config since in Chrome console I get a 404-Not Found for this file:

https://narin.biofokus.no/wp-content/plugins/advanced-iframe/js/iframe_height.html?height=1318&width=1026&id=narinbio&loc=https%3A%2F%2Fnarin.biofokus.no%2Findexbio_sa.lasso

This file should be on the parent site, not the iframe site right?

I see a file iframe_height.html in the plugin folder on parent site. Why is it looking for this file on the iframe site?

When I do an ajax call inside the iframe (e.g. show more table rows or expand a div so the height increases) the iframe does not expand in height.

Author:  TinyWebGallery [ 2. Feb 2019, 13:50 ]
Post subject:  Re: Problems with ajax inside iframe - collapses content

This is the file that is actually "receiving" the height info and all other stuff.

https://narin.biofokus.no/wp-content/plugins/advanced-iframe/js/iframe_height.html is missing. Maybe your serer disallows this.
This is the reason why auto height does not work. You should switch to post message communication. See the external workaround tab. Change this there to "debug"! Then you see in the browser console this data.
This is actually the default since a while. Have you installed the free version before? Because there this is the default there...

Best, Michael

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/