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

Add a class to the body of the parent site
https://www.tinywebgallery.com/forum/viewtopic.php?f=21&t=3736
Page 1 of 1

Author:  mikeatidriva [ 4. Oct 2014, 15:08 ]
Post subject:  Add a class to the body of the parent site

Hello
I want to add a class to the body of the parent site thats loaded in my Iframe. In the plugindescrition of crossdomain section there is written something about the option additional_js_iframe. But how does this work?

Regards,

Mike

Author:  TinyWebGallery [ 5. Oct 2014, 01:05 ]
Post subject:  Re: Add a class to the body of the parent site

I don't understand your setup: "body of the parent site thats loaded in my Iframe"

The parent is the site where the iframe is. But you mean the page that is inside the iframe?

In additional_js_iframe you can load additional Javscript where you simply use:
var additional_js_iframe = "jQuery('body').addClass(newClass);"

This has to be added before you include the ai_external.js script.
Best, Michael

Author:  mikeatidriva [ 6. Oct 2014, 11:46 ]
Post subject:  Re: Add a class to the body of the parent site

Hi Michael,

Thanks for your quick reply,

My apologies about my description of my question but some people use the term for parent the website that is loaded in the Iframe but this is exactly what I was looking for.

The only thing is I have to use this script to make it work

document.getElementsByTagName('body')[0].className+=' js'

What I stil wonder,
I can put only one script on the dashboard of our content supplier that's loaded in the iframe. But I need to add a class to the body depending on the url I'm using for the Iframe. Is this possible somehow?

Example:

Url 1: <iframe src="external-domain.nl/campings">.. body class = campings
Url 1: <iframe src="external-domain.nl/somethingelse">.. body class = search

Regards,

Mike

Author:  TinyWebGallery [ 6. Oct 2014, 12:05 ]
Post subject:  Re: Add a class to the body of the parent site

You than have to do some parsing of the url. But this should not be a big problem.

Best, Michael

Author:  mikeatidriva [ 10. Oct 2014, 14:16 ]
Post subject:  Re: Add a class to the body of the parent site

Hi Michael,

I have onther question regarding your iframe pro plugin...
I tried to do some parsing of the url but I noticed that the url is changed by the childpage (is an webapplication) I'm loading in the iframe so parsing by url is no option.
Is there a way to parse the id/class of iframe through the iframe and give the body on the childpage a class or id?

The height option works fine BTW. :)

Regards and thanks again

Mike

Author:  TinyWebGallery [ 10. Oct 2014, 14:29 ]
Post subject:  Re: Add a class to the body of the parent site

Check
pass_id_by_url

there you can pass the current iframe id to the iframe. I use this to automatially detect the correct callback id.
And you can use this for your purpose as well.

Best,
Michael

Author:  mikeatidriva [ 10. Oct 2014, 15:16 ]
Post subject:  Re: Add a class to the body of the parent site

Hi,

The respons is from the application in the Iframe: Configuration error: The id cannot be found in the url at the configured parameter
Im sending allready parameters to access the application (http://aanbod.waverunner.nl/start.aspx?layout=2&u=[userid])

Do you have any other ideas?

greetings

Mike

Author:  TinyWebGallery [ 10. Oct 2014, 15:34 ]
Post subject:  Re: Add a class to the body of the parent site

You have to configure the whole thing. If you use u you also have to set this before the script that this id is used.

See example 27
http://www.tinywebgallery.com/blog/advanced-iframe/advanced-iframe-pro-demo/resize-on-element-resize

but you can always simply attach an id to the src and parse this.

Best,
Michael

Author:  mikeatidriva [ 10. Oct 2014, 16:56 ]
Post subject:  Re: Add a class to the body of the parent site

Hi,

The Iframe application is changing the url from this
http://aanbod.waverunner.nl/start.aspx?layout=2&u=[userid])

in to something like this
http://b2c.waverunner.nl/%28S%28wts2021nk5korfscjraoi445%29%29/Frontends/Aanbod/Default/NL/Step1.aspx?Init

So there is no way to read the original url. So I hoped there was anotherway to do so..

Thanks for the update..

Mike

Author:  mikeatidriva [ 10. Oct 2014, 17:23 ]
Post subject:  Re: Add a class to the body of the parent site

Hi Michael,

I solved it... So simple...

This will do the job!
document.body.className = window.name;

Mike

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