![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
var xml_request = null; //Mozilla if(window.XMLHttpRequest) { xml_request = new XMLHttpRequest(); xml_request.open("GET", feed, false); xml_request.onreadystatechange = alert(xml_request.readyState); |
|
xml_request.setRequestHeader("Cache-Control", "no-cache"); xml_request.send(null); } Again, it works on Windows based computer just fine. But the Firefox and Safari browser on a Mac are where I'm having trouble. |
#3
| |||||||
| |||||||
|
|
On 2006-10-05 22:24:24 +0200, TLaufenberg (AT) gmail (DOT) com said: var xml_request = null; //Mozilla if(window.XMLHttpRequest) |
|
{ xml_request = new XMLHttpRequest(); xml_request.open("GET", feed, false); |
|
xml_request.onreadystatechange = alert(xml_request.readyState); This should cause an error in every browser. |
|
An event handler must be a function. |
|
The alert method returns nothing. |
|
| (typeof XMLHttpRequest == 'function')) object = new XMLHttpRequest(); |
|
| (typeof createRequest == 'function')) object = createRequest(); |
#4
| |||
| |||
|
|
Touffy wrote: This should cause an error in every browser. An event handler must be a function. The null and undefined values should be understood as "no listener". |
|
The alert method returns nothing. It returns undefined, which isn't quite the same thing. :-) |

#5
| |||
| |||
|
|
var xml_request = null; //Mozilla if(window.XMLHttpRequest) { xml_request = new XMLHttpRequest(); xml_request.open("GET", feed, false); xml_request.onreadystatechange = alert(xml_request.readyState); This should cause an error in every browser. An event handler must be a function. The alert method returns nothing. instead you should write: xml_request.onreadystatechange = function(){alert(xml_request.readyState)} xml_request.setRequestHeader("Cache-Control", "no-cache"); xml_request.send(null); } |
#6
| |||
| |||
|
|
Touffy, The suggestion you made is exactly what I have only I didn't create a function out of it. No need in writing more code then I really have to. |
|
xml_request.onreadystatechange = alert(xml_request.readyState); |
|
I'm beginning to think that Safari has a similar safeguard in place that I need to turn off somehow in order to allow my program to make a call to the method XMLHttpRequest.open b/c I believe that the method is being blocked instead of having an error in my code |
#7
| |||
| |||
|
#8
| |||
| |||
|
#9
| |||||
| |||||
|
|
I should have said it before but I'm trying to perform a cross-domain XMLHttpRequest and that is where my problem is rooted. We're trying to add RSS feeds to our Intranet. |
|
xml_request.onreadystatechange = alert(xml_request.readyState); The above line of code works exactly the same way as your line of code: xml_request.onreadystatechange = function(){alert(xml_request.readyState)} |
|
All that is being done here is when the readyState changes, to do something. |
|
I've realized what the problem is and it is that cross-domain XMLHttpRequests are not friendly. I found the workaround for FireFox which is: try { netscape.security.PrivilegeManager.enablePrivilege ("UniversalBrowserRead"); } catch (e) { } But I'm unsure of how to do this in Safari and Internet Explorer. |
|
If I wasn't dealing with the cross-domain non of this would be an issue. |
#10
| |||
| |||
|
|
xml_request.onreadystatechange = alert(xml_request.readyState); |
![]() |
| Thread Tools | |
| Display Modes | |
| |