PDA

View Full Version : Cross origin requests are only supported in HTTP



joethetree
22 May 2013, 2:48 PM
Hi,

After generating an app with the mvc pattern (sencha generate app MyApp C:\MyApp), I am getting the error "XMLHttpRequest cannot load file:///C:/MyApp/app.json. Cross origin requests are only supported in HTTP" and the app is stuck at the loading screen.

In Chrome, I can allow file access to get rid of this error but when packaging it as a native android app (sencha app build native) and running on the android emulator it seems that there is the same error (app is stuck at loading screen).

Is there a way to configure my emulator so this error gets taken care of? I am confused because if I understand the cause of the error, then everyone will get this error, but I can hardly find anything emulator-specific on Google...

Thanks!

Best,
Joe

joethetree
22 May 2013, 4:24 PM
In Chrome, I can allow file access to get rid of this error but when packaging it as a native android app (sencha app build native) and running on the android emulator it seems that there is the same error (app is stuck at loading screen).


Ok I was wrong, the error was caused by the following code block:


{ xtype: 'image',
src: Ext.Viewport.getOrientation() == 'portrait' ? '../../../img/login.png' : '../../../img/login-small.png',
style: Ext.Viewport.getOrientation() == 'portrait' ? 'width:80px;height:80px;margin:auto' : 'width:40px;height:40px;margin:auto'
},


The referenced image doesn't exist, which didn't cause an error in Chrome but the native app wouldn't launch. I literally removed code snippets for 3 hours while continuously rebuilding the native app and reinstalling it on the emulator. Any suggestions for better debugging of natively built apps B)?