0
如何將Access-Control-Allow-Origin: *
添加到Shiny應用程序中?R Shiny - 如何添加Access-Control-Allow-Origin:*
我想通過以下AJAX調用閃亮應用:
<div id='include-from-outside'></div>
<script type='text/javascript'>
$.get('//127.0.1.1:3838/', {}, function(data, status, xhr) {
var updatedData = data.replace(/\/(images|stylesheets|javascripts|vendors|fonts)+/g, "http://127.0.1.1:3838/$1");
$('#include-from-outside').html(updatedData);
});
</script>
但我得到這個錯誤:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://127.0.1.1 ' is therefore not allowed access.
任何想法?
謝謝。但可能我們不能要求用戶添加。有光澤的確是一個糟糕的框架。太多限制! – laukok
發生這種情況是因爲您正在向不同於您的頁面的域請求HttpRequest。你必須做這樣的事情。選中此鏈接[使用CORS](https://www.html5rocks.com/en/tutorials/cors/) – DragonBorn