Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I want cross domain data access for my project and i made it work but i am stuck with this pop up which says 'This page is accessing information.......' .I don't want to suppress it by explicitly changing browser settings, can't i modify my working code to suppress this message.

My working code with pop up
JavaScript
 $.ajax({
     url: "http://sys85/testservice/serviceCall.ashx",
    dataType: "text",
    type: 'get',
    crossDomain: true,
    success: function (data) {

    },
    error: function (jqXHR, textStatus, errorThrown) {
        if (window.console) console.log("Error... " + textStatus + "        " + errorThrown);

    }
});

    }


My handler file to return result(serviceCall.ashx)
C#
string result = "121";
context.Response.ContentType = "application/json";
context.Response.Write(result);


VB
do i have to make any changes with my handler file ??

Also tried this way


JavaScript
$(document).ready(function () {

    var url = "http://sys85/testservice/serviceCall.ashx";
    $.getJSON(url + "?callback=?", null, function (data) {
        alert(data);
    })
    .error(function (jqXHR, textStatus, errorThrown) {
        console.log("Error... " + textStatus + "        " + errorThrown);
        document.getElementById('lblmsg').value = "Error... " + textStatus + "        " + errorThrown;
    })
});


SQL
i get "Uncaught TypeError: Object # has no method 'error' " error

Tried every possible ways to get rid of this message Any help will be appreciated.
Posted

1 solution

Its a security risk and IE identified your code as a cross site scripting attack. This popup can be hidden by the user by lowering his browser security level and is not recommended at all.

This setting cannot be changed through the browser since your website runs in the browser , within the sandbox and does not have access to any browser settings.

Rather you should modify your code so that it will not resemble the cross site scripting

http://kite203.wordpress.com/2010/04/30/issues-solving-tip%E2%80%9Dthis-page-is-accessing-information-that-is-not-under-its-control-this-poses-a-security-risk-do-you-want-to-continue%E2%80%9D/[^]
 
Share this answer
 
Comments
Dexter11 11-Jun-12 9:35am    
Thanks for your quick reply but this wont help me i guess.

To elaborate my problem, my service would be located at particular location and it should be accessible from any XYZ domain.

Any user who paste my above code should be able to access this service.
Any suggestions for my problem?
StevenLJackson1 13-Feb-14 15:53pm    
I'm in the middle of dealing with this for a Cross Origin Resource Sharing service I need to interact with on IE8. I started looking into using the XMLDomainRequest object, which is supposed to handle this correctly, but I need to post a form to the service and the XDR object doesn't allow you to change any header information, and it posts without the "Content-Type: multipart/formdata" that I need.

If this is still an issue for you, you may want to consider using the XMLDomainRequest object in IE. Information about this object can be found here: http://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900