<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I am experimenting with clickable HTML app.<br />
I am using <em>clickable 7.6.0</em></p>
<p dir="auto">I generate a template using <em>clickable create</em> and I select HTML template.</p>
<p dir="auto">Then I try modifying the <em>index.html</em> webpage adding a simple ajax request:</p>
<pre><code>&lt;script&gt;
	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 &amp;&amp; this.status == 200) {
				console.log(this.responseText);
			}
		}
		// Sending our request
		xhr.send();
	}
	run();
&lt;/script&gt;
</code></pre>
<p dir="auto">While this code works opening the index.html file on Firefox, it seems ajax requests are blocked from the <em>webapp-containter</em>. I get this error:</p>
<pre><code>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.
</code></pre>
<p dir="auto">How can I enable the possibility make AJAX request from an HTML app? Is there any setting/policy to be changed?</p>
<p dir="auto">Thank you in advance for your help!</p>
]]></description><link>https://forums.ubports.com/topic/8266/clickable-html-app-accesss-to-xmlhttprequest-from-origin-file-has-been-blocked-by-cors-policy</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Mar 2026 18:29:24 GMT</lastBuildDate><atom:link href="https://forums.ubports.com/topic/8266.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Nov 2022 07:38:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Fri, 02 Dec 2022 05:29:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aitzol" aria-label="Profile: aitzol">@<bdi>aitzol</bdi></a> if you mean, your app works on the desktop bit not on the device, you are probably missing the networking policy in your apparmor manifest file. See <a href="https://docs.ubports.com/en/latest/appdev/platform/apparmor.html?highlight=Apparmor" rel="nofollow ugc">here</a> for further information</p>
]]></description><link>https://forums.ubports.com/post/68877</link><guid isPermaLink="true">https://forums.ubports.com/post/68877</guid><dc:creator><![CDATA[arubislander]]></dc:creator><pubDate>Fri, 02 Dec 2022 05:29:24 GMT</pubDate></item><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Thu, 01 Dec 2022 09:58:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lduboeuf" aria-label="Profile: lduboeuf">@<bdi>lduboeuf</bdi></a> only works for desktop</p>
]]></description><link>https://forums.ubports.com/post/68843</link><guid isPermaLink="true">https://forums.ubports.com/post/68843</guid><dc:creator><![CDATA[aitzol]]></dc:creator><pubDate>Thu, 01 Dec 2022 09:58:47 GMT</pubDate></item><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Thu, 03 Nov 2022 21:04:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lduboeuf" aria-label="Profile: lduboeuf">@<bdi>lduboeuf</bdi></a> It seems creating a QML container app works better thatn the HTML template method. Thank you for sending the link to your project.</p>
]]></description><link>https://forums.ubports.com/post/68241</link><guid isPermaLink="true">https://forums.ubports.com/post/68241</guid><dc:creator><![CDATA[bob0]]></dc:creator><pubDate>Thu, 03 Nov 2022 21:04:55 GMT</pubDate></item><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Thu, 03 Nov 2022 20:43:05 GMT]]></title><description><![CDATA[<p dir="auto">When testing with clickable desktop, the app performs AJAX calls without any problem.</p>
<p dir="auto">However, when testing on a real device (PinePhone, in my case),  AJAX calls are still blocked...</p>
]]></description><link>https://forums.ubports.com/post/68240</link><guid isPermaLink="true">https://forums.ubports.com/post/68240</guid><dc:creator><![CDATA[bob0]]></dc:creator><pubDate>Thu, 03 Nov 2022 20:43:05 GMT</pubDate></item><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Thu, 03 Nov 2022 15:12:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lduboeuf" aria-label="Profile: lduboeuf">@<bdi>lduboeuf</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/bob0" aria-label="Profile: bob0">@<bdi>bob0</bdi></a> This can also be achieved in the webview component: <a href="https://gitlab.com/cibersheep/quixe-qml/-/blob/master/qml/WebviewPage.qml#L41" rel="nofollow ugc">https://gitlab.com/cibersheep/quixe-qml/-/blob/master/qml/WebviewPage.qml#L41</a></p>
]]></description><link>https://forums.ubports.com/post/68229</link><guid isPermaLink="true">https://forums.ubports.com/post/68229</guid><dc:creator><![CDATA[CiberSheep]]></dc:creator><pubDate>Thu, 03 Nov 2022 15:12:29 GMT</pubDate></item><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Thu, 03 Nov 2022 11:56:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bob0" aria-label="Profile: bob0">@<bdi>bob0</bdi></a> said in <a href="/post/68218">clickable html app: Accesss to XMLHttpRequest from origin 'file://' has been blocked by CORS policy</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lduboeuf" aria-label="Profile: lduboeuf">@<bdi>lduboeuf</bdi></a> Thank you. It works. Just for my curiosity, was this documented somewhere?</p>
</blockquote>
<p dir="auto">This is standard "Chrome" security policy AFAIK</p>
]]></description><link>https://forums.ubports.com/post/68220</link><guid isPermaLink="true">https://forums.ubports.com/post/68220</guid><dc:creator><![CDATA[lduboeuf]]></dc:creator><pubDate>Thu, 03 Nov 2022 11:56:21 GMT</pubDate></item><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Thu, 03 Nov 2022 11:54:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lduboeuf" aria-label="Profile: lduboeuf">@<bdi>lduboeuf</bdi></a> Thank you. It works. Just for my curiosity, was this documented somewhere?</p>
]]></description><link>https://forums.ubports.com/post/68218</link><guid isPermaLink="true">https://forums.ubports.com/post/68218</guid><dc:creator><![CDATA[bob0]]></dc:creator><pubDate>Thu, 03 Nov 2022 11:54:55 GMT</pubDate></item><item><title><![CDATA[Reply to clickable html app: Accesss to XMLHttpRequest from origin &#x27;file:&#x2F;&#x2F;&#x27; has been blocked by CORS policy on Thu, 03 Nov 2022 11:35:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bob0" aria-label="Profile: bob0">@<bdi>bob0</bdi></a> in your desktop file, append <code>--disable-web-security</code> in your "Exec" line</p>
]]></description><link>https://forums.ubports.com/post/68216</link><guid isPermaLink="true">https://forums.ubports.com/post/68216</guid><dc:creator><![CDATA[lduboeuf]]></dc:creator><pubDate>Thu, 03 Nov 2022 11:35:09 GMT</pubDate></item></channel></rss>