I am trying to create a booklet which I wrote, starting an AJAX call on the ASPX page.
When I put javascript in a static HTML page, the code completely tests, but when I try and call it from the bookmarklet, the code is just XMLHttp.open ("GET" , Url, true) part.
The code of the bookmarklet is basically this (found on many instances on the web):
javascript: (function () {var s, d = Document, a = function (o) {d.body.appendChild (o)}; s = d.createElement ('script'); s.type = 'text / javascript'; s.src = 'http: // localhost / Squirt / sq.js'; a (s)}) ();
It currently adds the content of the browser to sq.js (AJAX call + some other processing), and then calls Ajax on my aspx page.
I am using ASP 2.0 (with VS 2008) and IIS 7. So far, I'm testing it on my home network.
I think there should be some permissions with AJAX calls from the external page, because as I said, everything works well from the static page. Is this an IIS setting that I call permission Need to change to give, or am I completely doing something wrong?
The XMLHttpRequest object is subject to the same Genesis policy.
This is the reason that the script that is loading your bookmarklet can not use XHR to get data from your server, unless it is embedded in your page from your server.
The script will work by adding a script tag by dynamically adding it, as you can tell - your bookmarklet can load the script from a different origin.
So your answer is Do not use the XMLHttpRequest object: Load your script dynamically into the bookmarklet.
JSONP works in this way (actually there is a bit more for JSONP, but this is what happens around SOP)
Actually, why not only
Comments
Post a Comment