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

Trying to change iframe links target
https://www.tinywebgallery.com/forum/viewtopic.php?f=21&t=4204
Page 1 of 1

Author:  xatucans [ 10. Jan 2017, 18:36 ]
Post subject:  Trying to change iframe links target

Hello, I've implemented an iframe with Advanced Iframe plugin in my web site: http://portabicis.com/buscador-de-compatibilidad/. The page displayed in the iframe is in a different domain (http://www.todosoportes.com) and I'd like to modify the its targets links, to be displayed as _top. I've configure Advanced Iframe Change iframe links and Change iframe links target parameters this way:

Change iframe links: .NavBarTop a
Change iframe links target: _top

But it doesn't work. Can you help me, please?

Thanks

Author:  TinyWebGallery [ 10. Jan 2017, 19:53 ]
Post subject:  Re: Trying to change iframe links target

you are not on the same domain. Therefore you need to use the external workaround.

Best, Michael

Author:  xatucans [ 11. Jan 2017, 11:31 ]
Post subject:  Re: Trying to change iframe links target

Hi Michael, thanks for your quick answer. I've configured in parent page (portabicis.com) the Advanced Iframe setting as I say you in the previous message:

Change iframe links: .NavBarTop a
Change iframe links target: _top

.NavBarTop is the class of iframe pages menu's div


After that, I've included this script in the iframe page, in (todosoportes.com):

<script>
var iframe_redirect_url = "http://www.todosoportes.com";
var change_iframe_links = ".NavBarTop a";
var change_iframe_links_target = "_top";
</script>
<script src="http://portabicis.com/wp-content/plugins/advanced-iframe/js/ai_external.js"></script>

But it doesn't work, could you tell me what is wrong?


Regards
Xatucans

Author:  TinyWebGallery [ 12. Jan 2017, 11:49 ]
Post subject:  Re: Trying to change iframe links target

I'll take a look tonight...

Author:  TinyWebGallery [ 12. Jan 2017, 23:13 ]
Post subject:  Re: Trying to change iframe links target

The problem is that the included page is https but you main page is http.
therefore the ai_external.js is loaded from a http site which is not allowed in https pages.
You see the error messages if you press f12 an check the console log.

You can
- Include the http version of the other page.
- Or you need to make it like here: http://www.tinywebgallery.com/blog/advanced-iframe/advanced-iframe-pro-demo/external-workaround-with-post-message#e53

Best, Michael

Author:  xatucans [ 13. Jan 2017, 11:45 ]
Post subject:  Re: Trying to change iframe links target

Thank you very much for your answer. I've changed bestskiracks.com ai_external.js to a secure server:

https://bestskiracks.com/wp-content/plugins/advanced-iframe/js/ai_external.js

but i doesn't work. If I look at the console I can see now this error:

DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://portabicis.com" from accessing a cross-origin frame.
at contents (http://portabicis.com/wp-includes/js/jquery/jquery.js?ver=1.12.4:2:26887)
at Function.map (http://portabicis.com/wp-includes/js/jquery/jquery.js?ver=1.12.4:2:3613)
at a.fn.init.n.fn.(anonymous function) [as contents] (http://portabicis.com/wp-includes/js/jquery/jquery.js?ver=1.12.4:2:27001)
at aiModifyIframe_advanced_iframe (http://portabicis.com/buscador-de-compatibilidad/:411:560)
at HTMLIFrameElement.onload (http://portabicis.com/buscador-de-compatibilidad/:423:782)


I've copied jquery.js and jquery.ba-resize.min.js to the same directory in the secure server and changed jquery_path and resize_path in ai_external.js document to the new locations, but the error persist. Could you help me please?

Thanks again
Regards
Xatu

Author:  TinyWebGallery [ 13. Jan 2017, 18:23 ]
Post subject:  Re: Trying to change iframe links target

The important setting is
var usePostMessage = true;
var domainMultisite = true;

because then the js does not try to callback the configured server but only the parent (and does not care where this is).

make it simpler - go to the administration and use post message communication and domain multisite! This is than saved to ai_external.js and also your wordpress is configured right!

then copy the ai_external.js again.

But is seems you have changed http://www.todosoportes.com - then you don't need the whole copy thing.
have you done both changes? because you only have to to one or the other...

also how looks your shortcode? because there are configuration errors also displayed in the log.

Best, Michael

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