views:

221

answers:

2

My current project for work involves developing a SharePoint 2007 WebPart which will be deployed by our clients. To provide a better user experience, I am "simulating" ajax via setting the SRC attribute of an IFRAME to be the address of an HTTP handler. These handlers are deployed to the layouts directory in the 12 hive.

Although this works, I would prefer to use the $get() method of jQuery. Will this work reliably in my scenario or will I still be subject to the same origin policy? What about the scenario where the WebPart is being deployed to various places on a SharePoint farm? Will there be any problems with using $get() in that case?

Would the Same Origin Policy prevent me from invoking an HTTP handler using $get?

A: 

The browser implements the same origin policy in normal viewing mode no matter if you are running locally or remotely. The domains must match.

Alex Sexton
Thanks, Alex. Yes, domain, port and protocol must match. What I really need to know is whether these three things will match if I am using $get to invoke an HTTP handler.
A: 

By adding the ashx handlers to the 12\TEMPLATE folder you are adding the handlers to all sites and sub-sites on your applications. Essentially, you have many copies of them.
If the AJAX call is relative to the domain, for example to /_layouts/foo.ashx, it will not be affected by the same origin policy.
Other scenarios, where the handlers are installed in a fixed location (e.g. Central Administration), will be blocked by the policy, same as every other page.

Kobi
Thanks, Kobi, I wondered if this might have been the case. My AJAX calls are indeed relative.