When testing with clickable desktop, the app performs AJAX calls without any problem.
However, when testing on a real device (PinePhone, in my case), AJAX calls are still blocked...
When testing with clickable desktop, the app performs AJAX calls without any problem.
However, when testing on a real device (PinePhone, in my case), AJAX calls are still blocked...
@lduboeuf It seems creating a QML container app works better thatn the HTML template method. Thank you for sending the link to your project.
When testing with clickable desktop, the app performs AJAX calls without any problem.
However, when testing on a real device (PinePhone, in my case), AJAX calls are still blocked...
@lduboeuf Thank you. It works. Just for my curiosity, was this documented somewhere?
Hello,
I am experimenting with clickable HTML app.
I am using clickable 7.6.0
I generate a template using clickable create and I select HTML template.
Then I try modifying the index.html webpage adding a simple ajax request:
<script>
function run() {
// Creating Our XMLHttpRequest object
var xhr = new XMLHttpRequest();
// Making our connection
var url = 'https://jsonplaceholder.typicode.com/todos/1';
xhr.open("GET", url, true);
// function execute after request is successful
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
}
}
// Sending our request
xhr.send();
}
run();
</script>
While this code works opening the index.html file on Firefox, it seems ajax requests are blocked from the webapp-containter. I get this error:
qml: [JS] (file:///home/bob0/Desktop/testapp/build/all/app/install/www/index.html:0) Access to XMLHttpRequest at 'https://jsonplaceholder.typicode.com/todos/1' from origin 'file://' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
How can I enable the possibility make AJAX request from an HTML app? Is there any setting/policy to be changed?
Thank you in advance for your help!