|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to write a script that will be loaded from one server into a website on another server. This script is trying to talk (ajax) to the server that it comes from but I'm getting "Access Denied" errors.
I'm well aware that cross-domain calls are not allowed for security reasons so my question is how does Google Analytics work because essentially thats what I'm trying to accomplish. I can embed a Google Analytics script into my website and it'll gather data and send it back to Google. Wondering how they do it? Help is much appreciated. Nik |
|
#2
|
||||
|
||||
|
just don't use XMLHttpRequest, and you'll be fine; javascript can come from any domain.
__________________
libs: mini (updated) ASPmini myIO (new) dnd tmpl8 apps: snippets blog photos crypto image editor crapplets: json browse json view compressor time grads |
|
#3
|
|||
|
|||
|
what should I use instead of XMLHttpRequest?
|
|
#4
|
||||
|
||||
|
two options:
Code:
function ping(paf){
var i = new Image();
i.src=paf;
}//end ping
function addScript(u){
var sc2=document.createElement('script'); sc2.src=u;
return document.getElementsByTagName('head')[0].appendChild(sc2);
}
__________________
libs: mini (updated) ASPmini myIO (new) dnd tmpl8 apps: snippets blog photos crypto image editor crapplets: json browse json view compressor time grads |
|
#5
|
|||
|
|||
|
Hahaha, brilliant...and so simple.
Thanks a million! Much appreciated. Nik |
![]() |
| Bookmarks |
| Tags |
| ajax, cross-domain |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|