IPhone Chrome&iphone UC Browser Jsonp accept Bug & h5 access-control-allow-origin cross-domain

Source: Internet
Author: User
Tags webp

In the Chrome and UC browsers of the iphone, when JSONP is used across domains, the request's accept will be: */*;IMAGE/WEBP.

When there is no special handling of content-type on the backend, the IMAGE/WEBP will be returned directly, and chrome and UC will not be able to perform the JS returned by JSONP.

Solution:

1, abandon the Jsonp form cross-domain, instead of setting access-control-allow-origin

Http://www.alloyteam.com/2012/11/html5-cors/?wpmp_switcher=mobile

2. When a cookie is required to cross a domain,

Back-end settings:

Access-control-allow-credentials:true,

Ajax settings:

Xhrfields: {
Withcredentials:true
}

It is important to note that Access-control-allow-origin cannot be set to * at this time

Otherwise the error is as follows:

XMLHttpRequest Cannot load Http://api.d.driver.edaijia.cn/workbench/userInfo?appkey=51000031&ver=3&met ... 11:16&ssid=u8srbnhpv2cogetnvaudrb3974&sig=61be8551eb4f8a8e3007ef748602df5e. A Wildcard ' * ' cannot be used in the ' Access-control-allow-origin ' header when the credentials flag is true. Origin ' http://h5.d.edaijia.cn ' is therefore not allowed access.

IPhone Chrome&iphone UC Browser Jsonp accept Bug & h5 access-control-allow-origin cross-domain

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.