Results 1 to 6 of 6

Thread: Urgent!!! AjaxTabs+overrideMimeType not work in IE

  1. #1
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Urgent!!! AjaxTabs+overrideMimeType not work in IE

    1) Script Title: AjaxTabs

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...axtabscontent/

    3) Describe problem:

    Hi, i'm displaying page with the encoding - GBK in my ajaxtabs <div>s.

    I added script like :

    ======================================================
    page_request = new XMLHttpRequest()
    if (page_request.overrideMimeType) {
    page_request.overrideMimeType('text/xml; charset=GBK');

    }
    ======================================================

    However, it only works in FireFox.

    The content appear as "?????" in IE.

    What can i do to solve this problem???

    Thank you!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    IE doesn't have:

    Code:
    overrideMimeType()
    The only alternative I have seen offered that seems to work with consistency is to make sure that both the top page and the external page are served with the proper encoding. There are various ways to do this, the best ones are done on the server side.

    See "5.2.2 Specifying the character encoding" on:

    http://www.w3.org/TR/html4/charset.html
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    IE doesn't have:

    Code:
    overrideMimeType()
    The only alternative I have seen offered that seems to work with consistency is to make sure that both the top page and the external page are served with the proper encoding. There are various ways to do this, the best ones are done on the server side.

    See "5.2.2 Specifying the character encoding" on:

    http://www.w3.org/TR/html4/charset.html
    thanks for your reminder..
    however, i'm hving difficulty accessing the link you mentioned above...
    can i have the link again?

    thanks!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    http://www.w3.org/TR/html4/charset.html#h-5.2.2

    Worked fine here, but I seem to have to refresh the page to get it to scroll to the named anchor.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    jscheuer1,

    just like to confirm...

    the most possible reason the page not shown properly is cause by the encoding problem.

    so if the main page encoding is GBK, for the external link, it should contained everything like below..

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd">
    		 
    <html>
    
    <head>
    <meta http-equiv="content-type" content="text/html; charset=GBK">
    </head>
    
    <body>
    the content of the page
    
    </body>
    </html>
    am i right?

    actually, i also tried to remove the red fonts (mentioned in my 1st post) and do something like this here:

    if (bustcachevar) //if bust caching of external page
    bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
    page_request.open('GET', url+bustcacheparameter, true)
    page_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset:GBK");
    page_request.overrideMimeType("text/html; charset=GBK");

    page_request.send(null)

    it works fine in Firefox, but in IE, it only display the status of "loading..." it can't get to display the content of the page...

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You have the right idea, but the wrong approach. As I said,

    overrideMimeType()

    doesn't exist in IE. At best, it will be undefined. The way you now seem to have it, I think it might cause an error in IE. Don't use overrideMimeType() for this. In fact, the script itself shouldn't be changed in the first place.

    You need to control the mime type character set header that the page is served with. You may be able to do so with meta tags on both the top and external pages, this will work with some servers. To really control the mime type character set header that your pages are served with, you need to configure your server. I'm not really experienced with how to do that (there are several ways and these can vary by server, as well as your access to it), but I did provide a link to information on how to do so. Your host may be a resource for you in this, it depends upon what type of host it is and what kind of support they offer.

    There are also other resources around the web you can find via Google or your favorite search engine that detail how to configure the server's mime type character set header, if your host allows and supports any of the possible methods.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •