View Full Version : Subdomain in Ajax Includes Script

07-23-2010, 07:05 PM
1) Script Title:
Ajax Includes Script
2) Script URL (on DD):
3) Describe problem:
is there a chance to use at least a subdomain from the same rootdomain?

My idea is to use a subdomain with a permanent redirect to my other server to pull the content.

07-24-2010, 02:18 AM
There are three reasons this will not work:

1. Ajax security restrictions are from browsers, not from this code. In other words, you can't "fix" the code to allow it.

2. Subdomains may be equal to different domains (perhaps depending on the specific browser) for ajax security restrictions. This is unfortunate, but just how it works. One possible trick might be to use the main domain (no subdomain, not even www) and then refer to the subdomain. In some cases (cookies, for example), this works in that direction, but not in the other or from subdomain to subdomain. I'm not sure how all browsers will react to this, but you can test it.

3. If you add a permanent redirect and you are using Ajax, then this will obviously not work: that isn't something hidden on the server, but a command to the user. That means that the Ajax security restrictions will block the content from the other server, even if you do get the subdomain to work.

The only way to approach this (assuming your current plans can't change) is to use a serverside language like PHP to load the page from the other server onto your server, then serve it from a page on the same domain (and probably subdomain). If the content you are loading isn't your own, though, be careful about copyright, etc.