Why net().get on success return empty string

2019-06-08 15:12发布

This is with playn. I use this, only to try how it works:

net().get("http://google.com", new Callback<String>() 
 {
   @Override
   public void onSuccess(String result) {
    drawResult(result);
   }                    
   @Override
   public void onFailure(Throwable cause) {
   // TODO Auto-generated method stub
     drawResult(cause.toString());
   }
 });
}

When i started this for Android or Java, onSuccess result is ok. When I started for html result is empty, where i wrong? Thanks and sorry for my bad English.

1条回答
相关推荐>>
2楼-- · 2019-06-08 15:35

That has to to with the Same origin policy for web browser: See http://en.wikipedia.org/wiki/Same_origin_policy

Workaround: Execute your (google-)query first from your webserver. Then let your webserver communicate with your PlayN-html-client.

查看更多
登录 后发表回答