SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XMLHttpRequest and Internet Explorer 7

    Does XMLHttpRequest work the same in IE7 as it doesn IE8?

    Would the following code work the same?

    Code:
      $objX = new XMLHttpRequest();
    
            if ($objX != null) {
    
                $objX.open("GET", "json/low-resulution-images.json ", true);
    
                $objX.onreadystatechange = function () {
    
                    //if readyState is not 4 or or status not 200 then there is a problem that needs attending
                    if ($objX.readyState !== 4) {
    
                        if ($objX.status !== 200) {
    
                            alert('HTTP error ' + $objX.status);
    
                        }
    
                    }
    
                };
    
                $objX.send();
    
                alert($objX.responseText);
    
            } else {
    
                window.alert("AJAX  not supported.");
    
            }
    I don't have a native version of IE7 so it is difficult for me to test for sure
    Let everyday be Christmas

  2. #2
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Divisive Cotton View Post
    I don't have a native version of IE7 so it is difficult for me to test for sure
    If you put IE8+ in compatibility mode, I think it emulates IE7.

  3. #3
    SitePoint Member
    Join Date
    May 2013
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In IE, You can use XDomainRequest instead of XMLHttpRequest

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,824
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by gamish View Post
    In IE, You can use XDomainRequest instead of XMLHttpRequest
    You would only do that for cross domain requests - you don't need it for requests within the one domain. The standard XMLHttpRequest() works with IE7+ the same as it does with other browsers within the same domain.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •