-2

I develop web/phone app that uses Google Endpoints. App properly works from localhost and when deployed to GAE. App also properly works in Intel XDK emulator and when debugged in Intel XDK App Preview on device.

App doesn't works when run on Android device as .apk. Looks like it cannot make call to Google Endpoints. It also doesn't works when running in browser from file system. In this case I see the exception:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').

Some answers (Google API in Javascript) provide information that issue can be solved by changing configuration on Google Console, but I cannot found anything in Google Console that related to origin.

I am new to mobile development, so I can had miss something obvious.

Any help will be very appreciated.

Community
  • 1
  • 1
Yuriy N.
  • 4,936
  • 2
  • 38
  • 31
  • 1
    Your question is very broad. First off it seems you do not know the difference between a hosted web application and a file opened locally. Take a look at your error. 'file://' is a pseudo protocol which will not work for ajax calls. However your question does not provide enough information to diagnose this issue much further. You might want to create a very simple test application and upload it on github. People here are much more likely to help you if they can look at your work and see what could be wrong. – konqi Jul 29 '15 at 11:20
  • @konqi Did you get all yours reputation by posting such useless comments? Phonegap application and application loaded from file system are very similar they both run without server. Do you understand difference between with server and without server? It was in very detailed way explained in question. Did you read it at all? – Yuriy N. Jul 29 '15 at 12:01
  • Dear yuri, reputation comes from upvotes, not from just posting. Anyway, I did read your question and I do have quite a bit of knowledge in GAE and PhoneGap development. Regarding the change of origin in the console. That's related to authentication (See console -> APIs & Authentication -> credentials -> OAuth). I doubt this will solve your problem though. You might want to try and whitelist your domain in phonegap (see: http://stackoverflow.com/questions/13920782/phonegap-javascript-sending-cross-domain-ajax-request) – konqi Jul 29 '15 at 13:13
  • this is a classic cross domain xhr error and googling it for cordova will give you the answer. – Zig Mandel Jul 29 '15 at 15:50
  • @ Zig Mandel. I followed your guide search for above exception plus cordova bring some pages where developers get similar exceptions but in different situations like "http" instead of "https". I read all these pages before and did not found there solution to my problem. So, if you know classic solution to this classic problem, may be you will be so kind to classically post the answer to the question? – Yuriy N. Jul 29 '15 at 18:25
  • @ konqi. Domain whitelistening looks promising. Thanks a lot! – Yuriy N. Jul 29 '15 at 18:28
  • @ konqi. Domain whitelistening actually works. Cheers. I added "*" to whitelistening domains config part and it started work. If you will post as answer, i will accept it with all my pleasure. – Yuriy N. Jul 30 '15 at 09:46
  • @yurin Don't worry about it - please accept your own answer so other readers know what the solution was. – konqi Aug 03 '15 at 14:07

1 Answers1

1

As it was supposed by konqi problem had solved by domain whitelistening

In Intel XDK it can be done by following next steps:

  1. Open Projects Tab
  2. Expand Build Settings
  3. Enter "*" (without quotes) to Domain List field.
Yuriy N.
  • 4,936
  • 2
  • 38
  • 31