Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)
I have code : app.request.setup({ crossDomain: 'true', headers: { 'Access-Control-Allow-Origin': '', 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept' }, beforeSend: function(xhr){ console.log("in before send !!!"); xhr.setRequestHeader('Access-Control-Allow-Origin', ''); xhr.setRequestHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); }, }); app.request.json('https://tiengnhateasy.com/test.json', function (data) { // app.request.json('http://localhost/html/tiengnhateasy_f7/www/test.json', function (data) { console.log("pageInit 00000000"); resolve( // How and what to load: template { componentUrl: './pages/catalog.html', }, { context: { myData: data, }, } ); }); } But err : Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header ‘Access-Control-Allow-Origin’ missing) Any idea how to fix it. Thanks so much!!!!!
You need to use the forum for issues like this: https://forum.framework7.io . also, CORS headers need to be set on top of your server/API scripts. Google on how to do it in PHP or use the cors package in Node JS. I have faced the same issue in the passed but setting these headers in the origin was so helpful.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed due to inactivity. If this issue is still actual, please, create the new one.