The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

about xmlhttpRequest javascript Object ...

Forums » Dev.Opera » Opera Extensions Development Discussions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

27. October 2011, 05:14:53

parkjieun

Posts: 3

about xmlhttpRequest javascript Object ...

HTML code and javascript :
---------------------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>POST/ GET XHR Example</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<script type="text/javascript">

//var url = "http://www.google.co.uk/search";
var url = "http://www.google.com/ig/api?weather=seoul";
var xmlhttp=null;

function getXMLHttpRequest() {
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
}

function get()
{
getXMLHttpRequest();


xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
DisplayResult(xmlhttp.responseText);
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();

};

function DisplayResult(strResult)
{
document.all["result"].value=strResult;
}
</script>
</head>
<body>

<a href="javascript:get();">get request</a> 실행


<textarea name="result" rows="10" cols="80"></textarea>
</body>
</html>

----------------------------------------------------------------------

It doesn't work in the opera browser. ( it does work in IE.)
(security violation error...)

so, I have tried to find the cause.

and, I have found. Opera browser don't support CORS(cross orfin resources sharing) at all right now.

I want to use Google weather API... in the Opera browser.

so, I need Xmlhttprequest ... but It does not use .

Is there an alternative to it ???

help please

27. October 2011, 15:14:27

Mintsoft

Posts: 54

Hi,

Have you enabled network access to the URL in your extension's config.xml (see: http://www.opera.com/docs/apis/extensions/configxmlresourceguide/#cxaccess)?

-Rob
Presto/2.10.289 Opera 12.00 on Windows 7 Professional 64Bit

Forums » Dev.Opera » Opera Extensions Development Discussions