473,606 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SOP problem in AJAX especially with IE

RamananKalirajan
608 Contributor
Hi those who were working in Ajax, will surely experienced with this problem. SOP - Single Origin Policy problem. I am doing a small work in Prototype Ajax. I did a sample work. When I am passing the URL to the Ajax call within the same directory. It is showing an exception "Access Denied". The cause for this exception is SOP. This occur only with the IE. Had anyone overcome this problem. If so means pls tell me that would be very helpful for me.

The sample code I worked out

[HTML]<html>
<head>
<title>Prototyp e GET Example</title>
<script type="text/javascript"src= "prototype.js"> </script>
<script type="text/javascript">
function requestCustomer Info() {
var sId = document.getEle mentById("txtCu stomerId").valu e;
var oOptions = {
method: "get",
onSuccess: function (oXHR, oJson) {
displayCustomer Info(oXHR.respo nseText);
},
onFailure: function (oXHR, oJson) {
displayCustomer Info("An error occurred: " +
oXHR.statusText );
},
onException: function (oXHR, oJson) {
displayCustomer Info("An Exception occurred: " +
oXHR.statusText );
}
};
var oRequest = new Ajax.Request("d emo1.html", oOptions);
}
function displayCustomer Info(sText) {
var divCustomerInfo = document.getEle mentById("divCu stomerInfo");
divCustomerInfo .innerHTML = sText;
}
</script>
</head>
<body>
<p>Enter customer ID number to retrieve information:</p>
<p>Customer ID: <input type="text" id="txtCustomer Id" value="" /></p>
<p><input type="button" value="Get Customer Info" onclick="reques tCustomerInfo() " /></p>
<div id="divCustomer Info"></div>
</body>
</html>[/HTML]

This piece of code is working fine with all the other browser except the IE. If u wantto test this file, pls download the prototype.js from the site http://prototypejs.org/download and have the demo1.html file within the same folder. Then only u will be able to view the change. I am not using any server kind of stuff. Any one having solution to the SOP problem pls help me out

Regards
Ramanan Kalirajan
Aug 8 '08 #1
5 2513
acoder
16,027 Recognized Expert Moderator MVP
If it's from the same server/directory, it won't be a same origin policy error.

If you access the demo1.html file directly, are there any problems?
Aug 9 '08 #2
RamananKalirajan
608 Contributor
If it's from the same server/directory, it won't be a same origin policy error.

If you access the demo1.html file directly, are there any problems?
Yes, Mr. Acoder. It's showing an Exception namely Access Denied. I read about the Access Denied in google, from there i got it was due to SOP. You just try this code.

Regards
Ramanan Kalirajan
Aug 11 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
No, I meant directly without using Ajax.
Aug 11 '08 #4
RamananKalirajan
608 Contributor
No, I meant directly without using Ajax.
Thanks Mr. Acoder, the code is working when it is run with a help of server. The server is responsible for classifying the errors. So my code is working good for on404 and other error cases also. My problem solved I am movind ahead over that. Thank you very much.

Regards
Ramanan Kalirajan
Aug 12 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Glad to hear that you've got it working (even if a little unexpected ;))
Aug 12 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
1282
by: Matt Kruse | last post by:
In the past couple of weeks, I've heard a number of references to the term "Ajax". A fellow developer asked me if we should use ajax on a web app, and I asked "what is that?" "Oh, it's a brand new way of developing web pages which refresh in the background using XmlHttpRequest!" "Oh, you mean like what people have been doing for a long time???" Well, apparently the person had read this:
2
4159
by: Larry | last post by:
I am wondering if anyone has any thoughts on the following issues once Ajax is incorporated into a page: Now that we have this Ajax stuff, users have the potential to not leave a page for a long time. My knowledge of browser memory handling is limited, but I spoke with a Microsoft engineer who told me that IE has a very naive mark and sweep GC algorithm, which gets invoked when a page gets reloaded. If the GC is not invoked until a...
4
4048
by: VK | last post by:
Google Trends is an all new service (started May 10) and I have not responsability for proper query or data accuracy. Overall seems pretty close to what could be observed by the post history in c.l.j. Just curious why exactly Japan got so exclusively hot on JSON ? <http://www.google.com/trends?q=AJAX+JavaScript&ctab=0&geo=all&date=all> <http://www.google.com/trends?q=JSON+JavaScript&ctab=0&geo=all&date=all>
1
1837
by: codefragment | last post by:
Hi I have asked this on the official asp.net forums but no luck so thought I'd try here Assume you have a page with a filter control and a grid view and many other controls on it. When the filter changes you want the gridview to change but nothing else. In particular all you would like to happen is for an ajax call to occur and a new grid view to be returned.
1
1653
by: tysu | last post by:
When I visit programming talk I find out a hot topic talking about Levyo Ajax Technology Gallery. Their site is at http://levyo.com - demo at http://gettingzone.com. They build Ajax application on PHP, Mysql. Their gallery runs so fast, especially when I login, register, submit, rate, write comment, upload, process, Tab feature... It's great. How can they do especially "unlimited tab feature", you can add new category in Admin CP, it...
17
11858
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);" onclick="show('ajaxrequest.php?action=removefield','div1');show('ajaxrequest.php?action=reloaddiv2','div2')">verwijderen</a> While both seperate actions work they dont when I put them together. Anyone know how to fix this ? My ajax.js with funcition show
8
4164
by: BillE | last post by:
I have an existing asp.net 2.0 webforms app using master/content pages, and it works fine. I added some Ajax elements, including some UpdatePanels and modal PopUp panels which contain asp.net controls like gridviews with selectable rows, buttons, textboxes. I'm using Ajax 1.0, and the users are still using IE 6. Some heavy users reported that the application starts to run slowly after a while, and task manager shows the memory usage...
8
4326
by: Bill Gower | last post by:
I have a webapp that uses the AjaxControlToolkit. The app and ajax works fine when run within my dev server in Visual Studio 2005 but does not work on IIS. Any Suggestions? Bill
2
2263
by: KBS Tours Development | last post by:
Hi, I've deployed latest release on production with new AJAX functionality but the server posts back completely and toolkit functionalities are not working at all like calendar etc. Here is what I've done and what I have 1. Installed AJAX on production 2. Rebooted and no errors are thrown but doing complete postback
4
1494
by: ton | last post by:
Hi, I wander what to do. I'm developing a webapplication. One of the parts is to show records from a database. To modifiy a value, text of relational link or date I would like to use Ajax where possible. I saw the posiibilty of the Ajax control toolkit with the calendar extender. How nice. But is it fast? Thats the question, because the roundtrip to the server would build the full page in postback and only the changes will be posted...
0
8024
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8310
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6781
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5968
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5466
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3942
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2451
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.