我在AMP页面上使用Paypal“buy now”按钮时遇到问题(它在非AMP页面上工作)
我正在使用此按钮(贝宝网站的代码):
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="charset" type="hidden" value="UTF-8"> <input name="cmd" type="hidden" value="_xclick">
<input name="business" type="hidden" value="email">
<input name="undefined_quantity" type="hidden" value="1">
<input name="item_name" type="hidden" value="text">
<input name="amount" type="hidden" value="30.00">
<input name="shipping" type="hidden" value="0.00">
<input name="shipping2" type="hidden" value="0.00">
<input name="currency_code" type="hidden" value="EUR">
<input name="lc" type="hidden" value="FR">
<button type="submit" name="submit" class="no-padding">
<img src="https://www.paypal.com/fr_FR/i/btn/btn_buynow_LG.gif">
</button>
<img src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" alt="text" width="1" height="1">
</form>
错误是:Access to fetch at \'https://www.paypal.com/cgi-bin/webscr?_wp_amp_action_xhr_converted=1&__amp_source_origin=https%3A%2F%2Fwebsiteurl\' from origin \'https://websiteurl\' has been blocked by CORS policy: No \'Access-Control-Allow-Origin\' header is present on the requested resource. If an opaque response serves your needs, set the request\'s mode to \'no-cors\' to fetch the resource with CORS disabled.
www.paypal.com/cgi-bin/webscr?_wp_amp_action_xhr_converted=1&__amp_source_origin=https%3A%2F%2Fwebsiteurl:1 Failed to load resource: net::ERR_FAILED
log.js:258 [amp-form] Form submission failed: Error: XHR Failed fetching (https://www.paypal.com/...): Failed to fetch
at bb (https://cdn.ampproject.org/v0.js:29:169)
at Ya.f.createExpectedError (https://cdn.ampproject.org/v0.js:24:235)
at https://cdn.ampproject.org/v0.js:142:154
我已经查看了有关核心问题的amp文档here 我已经理解了主要问题,但我无法解决它,我已尝试将此添加到我的。htaccess但存在相同问题:Header set Access-Control-Allow-Origin \'https://cdn.ampproject.org\'
Header set AMP-Access-Control-Allow-Source-Origin \'https://your-domain.com\'