You need to be logged in to post in the forums. If you do not have an account, please sign up first.
unable to do a cross domain http request
Hi,I am unable to get the cross domain http request working. Also unable to debug on localhost as well.
I have also set network attribute to public in the config.xml
Using the following configuration of opera
Version
10.51
Build
3315
Platform
Win32
System
Windows XP
Any help is appreciated.
Thanks,
Shailesh.
I checked photo editor widget (go to "Help" -> "Send us a message") with exactly the same build and everything seems to be all right. Maybe the problem is with your JavaScript code? Can you dpaste it ?
Thanks Iowik.
I am doing a simple ajax GET request.
I keep getting the security violation error.
JavaScript - widget://wuid-4bbca597-c485-0eea-0b65-24c7c4cd9b36/index.html
Error thrown at line 26, column 4 in init() in widget://wuid-4bbca597-c485-0eea-0b65-24c7c4cd9b36/script/main.js:
req.send(null);
Uncaught exception: ReferenceError: Security violation
and this is my config.xml file
Have also attached the widget.
Am not sure what am I doing wrong here :-(
simple_test.wgt
I am doing a simple ajax GET request.
window.onload = init;
function init(){
canvas = document.getElementById('canvas');
context2D = canvas.getContext('2d');
context2D.fillStyle = '#000';
context2D.fillRect(0,0,canvas.width,canvas.height);
var req = new XMLHttpRequest();
var uri = "http://www.google.com";
req.open('GET', uri, true);
req.onreadystatechange = function(){
if (req.readyState == 4) {
if (req.status == 200) {
alert('success');
}
else {
alert('error');
}
}
};
req.send(null);
}
I keep getting the security violation error.
JavaScript - widget://wuid-4bbca597-c485-0eea-0b65-24c7c4cd9b36/index.html
Error thrown at line 26, column 4 in init() in widget://wuid-4bbca597-c485-0eea-0b65-24c7c4cd9b36/script/main.js:
req.send(null);
Uncaught exception: ReferenceError: Security violation
and this is my config.xml file
<?xml version='1.0' encoding='UTF-8'?>
<widget dockable="yes" network="public">
<widgetname>Simple Test</widgetname>
<description>testing ajax</description>
<width>1024</width>
<height>768</height>
<icon>images/icon.png</icon>
<author>
<name>Shailesh</name>
</author>
<security>
<access>
<protocol>https</protocol>
<protocol>http</protocol>
<host>google.com</host>
</access>
</security>
</widget>
Have also attached the widget.
Am not sure what am I doing wrong here :-(
simple_test.wgt
You wrote <host>google.com</host> but you mean <host>www.google.com</host>
Better leave the <security> tag out, then you have access to every site.
Only if you specify a host the widget will be limited to the given hosts.
Better leave the <security> tag out, then you have access to every site.
Only if you specify a host the widget will be limited to the given hosts.
An example is that if the host element is missing, the widget is requesting access to all hosts.
Opera Widgets specification 1.0, fourth edition, 4.13 The access element
Thanks a lot Dodwin.
Works great without the security tags or
security tags with "www" added
was blind folded in following different articles :-). All examples in those seem to leave out "www" though
Works great without the security tags or
security tags with "www" added
was blind folded in following different articles :-). All examples in those seem to leave out "www" though
Has anybody got the cross domain ajax request working inside YUI?
The same code when I use it inside YUI leads to the security violation
The same code when I use it inside YUI leads to the security violation