Page 1 of 1

How to Domain/subdomain iframe template integration

Posted: Wed Jan 01, 2020 8:01 pm
by axew3
OBSOLETE since date of this post:
viewtopic.php?p=4549#p4549



This is an excerpt of a reply that easily explain how to fix the iframe template integration into domain/subdomain installations
..... iframe not resize ..... .....

Hi there! So, resuming here all things about iframe and correct configuration for subdomains.
May something will be setup to fix these issues, in the while this is the point.

then i installed both phpBB WP into this subdomain:
[code]https://subdomain.w3host.com/wordpress
https://subdomain.w3host.com/phpbb3[/code]
all work sparkly, i've just setup for the overall_footer.html code, subdomain.w3host.com, and nothing else needed.

But of course, the problem have come out when i installed

Code: Select all

https://w3host.com/wordpress
linking it to the subdomain phpBB.
So,in this kind of scenario, wp is at w3host.com, while phpBB is on subdomain subdomain.w3host.com.

What to do to make it work fine is just this

into phpBB overall_footer.html:

Code: Select all

document.domain = 'w3host.com'; // MANDATORY! // Set/Change this value to your domain (example: axew3.com (or leave localhost if on localhost))
then open page-forum (or whatever named)
where this:

Code: Select all

document.domain = '".$document_domain."';
//document.domain = 'w3host.com'; // NOTE: reset/setup this with domain if js error when WP is installed like on mysite.domain.com and phpBB on domain.com: js origin error can come out for example when WordPress is on subdomain install and phpBB on domain. The origin fix is needed: (do this also on phpBB overall_footer.html added code)
change into:

Code: Select all

//document.domain = '".$document_domain."';
document.domain = 'w3host.com'; // NOTE: reset/setup this with domain if js error when WP is installed like on mysite.domain.com and phpBB on domain.com: js origin error can come out for example when WordPress is on subdomain install and phpBB on domain. The origin fix is needed: (do this also on phpBB overall_footer.html added code)
then change this:

Code: Select all

 // array() of allowed domains
    var w3all_orig_domains = ['".$w3all_orig."','".$w3all_orig_www."','https://localhost','http://localhost'];
into this:

Code: Select all

 // array() of allowed domains
    var w3all_orig_domains = ['".$w3all_orig."','".$w3all_orig_www."','https://localhost','http://localhost','https://w3host.com','http://w3host.com'];
All will work fine.

NOTE IMPORTANT: http://w3host.com is recognized differently by http://www.w3host.com (like http and https).
So if your server not force a way or other, and is accessible may both via https or http, and www or not www, then you have to add these possible variants into this array.

I will try to automatize for subdomains all this, by the way it will be not simple, because the problem are domains like:
mydomain.co.uk
that's not clearly a subdomain.
So it is not so easy to work around this. I've do a little code that using array of possible registered valid domains, check for correct value and never fail. By the way to use it, then the code should iterate into each time, or it's needed to provide a one time procedure, that will setup correct values.