IE8 HTTPS Warning Using jQuery AJAX

I am experiencing a strange issue when reading a text file using jQuery Ajax. For some reason when my page using the code (below) in Internet Explorer 8 over a https:// protocol I get a message: "Do you want to view only the webpage content that was delivered securely?"

function GetData(carModel) {
    var ca = "";

    jQuery.ajax({
        type: "GET",
        url: "../data.txt",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: "",
        async: false,
        success: function (result) {
            $.each(result, function (i, q) {
                if (q.model == carModel) {
                    //Retrieve info...

                    return false;
                }
            });
        },
        error: function () {
        },
        complete: function () {

        }
    });

    return ca;
}

Open in new window


This only seems to be happening on pages using this code. Since I am reading a local file on my site, I can't think of a reason to why the IE8 popup keeps appearing.
R1ND3RAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrh14852Commented:
That's because you are requesting non-secure content over a secure connection so you now have "mixed content".  IE is always going to throw that error unless you disable it in the IE settings.

I found this for disabling it.

http://www.labnol.org/software/ie-security-warning-for-https-websites/13388/
0
nap0leonCommented:
mrh14852 - you are saying that when you use a relative path in an ajax request it is always going to use http instead of the http/https of the client's current URL?  I was thinking that this might be the case, but I have not found any documentation to support my theory.

if so, rather than manipulating IE's security settings, the solution would seem to be to change the URL to be fully qualified (e.g., https://... ... /data.txt) instead of relative.
0
mrh14852Commented:
It wouldn't hurt to try as a test just to make sure that is what is happening...if you still get the problem then maybe we have something else at play here.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

R1ND3RAuthor Commented:
nap0leon, I would have thought using a relative path in my Ajax request would suffice for http or https protocols.

Have any of you experienced the same issue when using an Ajax request over https?
0
nap0leonCommented:
Whenever I work in a mixed security domain, just as a force of habit, I always use fully qualified paths - for all resource requests - images, js library files, AJAX requests, etc. - just to be sure there are no mixed security issues.

Out of curiosity, can you give it a whirl and let us know if that fixes it? (Unfortunately, I don't have access to a site with a valid SSL cert at the moment, so I cannot verify independently.)

Is your <script> that loads the jQuery library using relative pathing or absolute?
0
R1ND3RAuthor Commented:
This is fixed now and the reasoning behind the fix is really stupid.

With the help of Fiddler, I found that someone did in fact put an external link to a jQuery file even though I have a local jQuery file in my site.

Since the error is entirely due to a fault on my end, I am sharing the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

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.