当前位置: 动力学知识库 > 问答 > 编程问答 >

jquery - WebView does not really support CORS in JavaFX 2.2?

问题描述:

  • We implemented app that used WebView of JavaFx for showing webpages and they were deployed at Bob domain.
  • In web pages, javascript block had use jquery ajax do GET request to Alice domain.

    Alice domain filtered request by CORS filter like http://software.dzhuvinov.com or eBay.

  • And at Alice domain, these CORS filters also checked Origin header from request.

    If Origin attribute was not in request header that not be a valid CORS request. And browser fire error because doesn't have Access-Control-Allow-Origin attribute in response header

  • We used Wireshark to trace request header and detected that browser of WebView did not add Origin attribute. Then we also check the browsers(Firefox, Chrome, IE) and had supported.

So how to make browser of WebView add Origin like others or solution? And we also try to add Origin in headers of jquery ajax setting but browser leave it out.

Thanks

网友答案:

For those who haven't/don't want to sign up to JIRA.

Adding sun.net.http.allowRestrictedHeaders=true as a VM arg will turn cors back on for JavaFX WebView.

分享给朋友:
您可能感兴趣的文章:
随机阅读: