I got this cross domain ajax script some where and found it is working. You can run this file just directly from your desktop. You don’t have to have the localhost. The code enables a kind of privilege. This worked in firefox and for internet explorer there is another method for their own use. copy paste the code as html and click the get button.
Besides… I would like to have objections if any and comments about this article so that i can update. It is not just an article but a public document to which people can provide info to testify this. Just like that. How the following will be in future
<script type="text/javascript" language="javascript"> // Error: uncaught exception: Permission denied to call method XMLHttpRequest.open var http_request = false; function makeRequest(url, parameters) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) { alert("Permission UniversalBrowserRead denied."); } http_request = false; http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open('GET', url + parameters, true); http_request.send(null); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { var string = http_request.responseText; alert(string); } else { alert('There was a problem with the request.'); } } } function updateweather() { makeRequest('http://www.wunderground.com/auto/rss_full/global/stations/16239.xml', ''); } </script> |
<input type="button" name="button" value="GET XML" onclick="javascript:updateweather();"> |
Recent Comments