Results 1 to 2 of 2

Thread: Subdomain in Ajax Includes Script

  1. #1
    Join Date
    Jun 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Subdomain in Ajax Includes Script

    1) Script Title:
    Ajax Includes Script
    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...axincludes.htm
    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.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •