{"id":227,"date":"2010-11-28T04:34:27","date_gmt":"2010-11-27T23:04:27","guid":{"rendered":"http:\/\/vikku.info\/codesnippets\/?p=227"},"modified":"2010-11-28T04:34:27","modified_gmt":"2010-11-27T23:04:27","slug":"ajax-cross-domain-xmlhttprequest-in-firefox","status":"publish","type":"post","link":"http:\/\/vikku.info\/codesnippets\/ajax\/ajax-cross-domain-xmlhttprequest-in-firefox\/","title":{"rendered":"ajax cross domain xmlhttprequest in firefox"},"content":{"rendered":"<p>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&#8217;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.<\/p>\n<p>Besides&#8230; 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 <\/p>\n<pre lang='javascript'>\r\n<script type=\"text\/javascript\" language=\"javascript\">\r\n\r\n\/\/ Error: uncaught exception: Permission denied to call method XMLHttpRequest.open\r\n\r\n  var http_request = false;\r\n\r\n  function makeRequest(url, parameters) {\r\n\r\n   try {\r\n    netscape.security.PrivilegeManager.enablePrivilege(\"UniversalBrowserRead\");\r\n   } catch (e) {\r\n    alert(\"Permission UniversalBrowserRead denied.\");\r\n   }\r\n\r\n    http_request = false;\r\n    http_request = new XMLHttpRequest();\r\n    if (http_request.overrideMimeType) {\r\n      http_request.overrideMimeType('text\/xml');\r\n    }\r\n    if (!http_request) {\r\n      alert('Cannot create XMLHTTP instance');\r\n      return false;\r\n    }\r\n    http_request.onreadystatechange = alertContents;\r\n    http_request.open('GET', url + parameters, true);\r\n    http_request.send(null);\r\n  }\r\n\r\n  function alertContents() {\r\n    if (http_request.readyState == 4) {\r\n      if (http_request.status == 200) {\r\n\r\n        var string = http_request.responseText;\r\n      alert(string);\r\n\r\n      } else {\r\n        alert('There was a problem with the request.');\r\n      }\r\n    }\r\n  }\r\n  function updateweather() {\r\n    makeRequest('http:\/\/www.wunderground.com\/auto\/rss_full\/global\/stations\/16239.xml', '');\r\n  }\r\n<\/script>\r\n<\/pre>\n<pre lang='html4strict'>\r\n<input type=\"button\" name=\"button\" value=\"GET XML\" \r\n  onclick=\"javascript:updateweather();\">\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/227"}],"collection":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":1,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":228,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/227\/revisions\/228"}],"wp:attachment":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}