CORS - IE8 and up with jquery

I know I asked this before or a question very similar to this one, but this is throwing me for a loop and was wondering if someone has ever experienced this before.

In IE8 my js code that I have in place will work when I call my web-service using localhost:#portnumber from my site which is using localhost:#differentportnumber.

As soon as I try this using domains, then it fails, and for the domains it is myproduct.domain.com (web site) to api.domain.com (my web service) where domain.com is the same domain name. It doesn't get to the service call, and throws an access denied message as it attempts to make the call.

Any ideas on why this is working like this.


   $.support.cors = true;
    $.ajax({
        type: "post",
        url: strUrl,
        
       contentType: "application/json; charset=utf-8",
       //contentType: 'text/plain',
        data: JSON.stringify(jsonObject),
        //beforeSend: function (xhr) {
            //xhr.setRequestHeader("sidw-token", getToken());
        //},
        crossDomain: true,
        success: function (msg) {
         //   alert(JSON.stringify(msg[0]));
            successDisplayPatientList(msg);
        },
        error: function (msg) {
            alert(JSON.stringify(msg));
            
        }
    });

Open in new window

JDEE8297Asked:
Who is Participating?
 
JDEE8297Connect With a Mentor Author Commented:
Julian: I really dont care how much of the marketshare the browser has, but if the majority of my users who come to the site are using IE8 and above, then I have to support that marketshare and it is alot more than 5%.

As a developer we can't choose what we support and don't support when it comes to web development, if that was the case, then we would need all of our respecive visitors to upgrade to the latest and greatest version of all browsers. However, we all know that is not going to happen because of users from corporations who are stuck on some old browser version because of legacy or internal upgrade path.

The only IE version that I refuse to support in this day and age is IE6 and more recently leaning towards dropping IE7 support as well. All of this is based on my analytics of the visitors to our site.

mplungjan: Yep, already came across that one in my research, turns out I was able to finally get it to work. I used XDomainRequest and checked to see if the browser was IE or not, if IE then XDOmainRequest and if not then continue the ajax jquery route.
0
 
JDEE8297Author Commented:
this is the originally question on the subject.

http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28140964.html

but I had reverted this back to my original approach, because I saw it working on the localhost:#portnumber scenario, and from what I understand that is the same thing using the domain approach.
0
 
Julian HansenCommented:
My recommendation - save yourself some time and don't support non-compliant browsers.

IE8 has < 5% of the browser market see my rant here for more http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_28145902.html
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Michel PlungjanIT ExpertCommented:
Julian: That is a very nonchalant suggestion. I work for an organisation with 8000 internal users, all on IE8 and no way to change that in the foreseeable future. All our code supports IE8+ and until very recently IE6 too
0
 
Julian HansenCommented:
@mplungjan that is an internal issue and it does not change the fact that IE8 must go.

If you have a specific project that has to support IE8 then that is different but for websites out in the wild time spent getting non-compliant browsers to work is a waste and it gives MS license to continue producing inferior software.

Organisations that are still running IE8 should be more proactive and move onto a more compliant browser - the trend is that their users are in an insignificant minority and catering to < 5% of users has no value at all.

Disagree if you will but I lost too many (unpaid) hours of my life because of IE rubbish and it is time that browser dissappeared or became 100% standards compliant - I don't care which as I do not support IE - if my sites work on IE great - if not I don't care.
0
 
Michel PlungjanIT ExpertCommented:
great for you that you have the luxury. Others do not. Does not matter how much I agree with you. My management does not.
0
 
JDEE8297Author Commented:
Julian: I agree with you that IE support needs to be down the latest version of the browser, and regardless if it is in the wild, you have to based your browser support on your analytics or at least use that as  guideline.

Example: ecommerce site
If 80% of your traffic is coming from IE8 and that works out to be about 1 to 2 million in sales, and you decide that you are only going to support standards compliant browsers and not IE8. Then you may get a percentage of that to switch over, but people are lazy or as I mentioned above...don't have the option to switch to the newest browser.

I am glad you have the luxury to choose what you support or dont support, but you have to be smart about how you cut off people on old browsers.

I have being doing this a long time, and have heard all of the stories about how IE sucks and so on, and we should do everything in Chrome or Firefox and so on. However, at the end of the day the customer is always right....no matter how much that makes your job a PITA to support old browsers.
0
 
Julian HansenCommented:
If 80% of your traffic is coming from IE8

If pigs could fly ...

Reality is 80% of any traffic is highly unlikely to be from IE8 users - and definitely not worth 1-2million in sales. You can get around any argument with unrealistic assumptions.

IE8 is a speedbump - support it if you wish - it is your time - I am joining the growing group of developers who refuse to be dictated to by MS on how we want to code and how we want to spend our time.
0
 
Michel PlungjanIT ExpertCommented:
I agree, however you would not get a job at our company if you do not support ie8. Simple as that.
0
 
Julian HansenCommented:
@mplungjan - would not even consider applying - I work with people who live in the future not the past.
0
 
JDEE8297Author Commented:
It is the only way to make this work in older IE versions (not sure about IE7 and below, but I am not supporting those versions for my site).

Using XDomainRequest and it works like a charm
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.