我最近刚刚发布了一个与此非常相似的问题,但使用 javascript 实现了它并完全在单独的窗口中打开它。从那以后,我走得更远,开始实现 twitter bootstrap,并认为使用模态将非常适合在不打开更多窗口的情况下实现同样的想法。
我读过类似的帖子,发现可能是因为“原产地政策限制”。
我运行的是 Django 1.6.1、Python-Social-Auth 和 Twitter Bootstrap。我有一个这样的链接:
<a class="loginModalLink"
href="{% url 'social:begin' 'linkedin-oauth2' %}"
data-target="#loginModal" data-toggle="modal">
<button type="button" class="btn btn-success btn-xs">
<span class="glyphicon glyphicon-user"></span>
Sign In
</button>
</a>
以及相应的模态。
<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">One fine body...
</div>
</div> <!-- ./modal-content -->
</div> <!-- ./modal-dialog -->
</div>
我也尝试在模式中使用 data-remote="" 标记,但没有任何运气。
这是我在 Javascript 控制台中遇到的错误:
XMLHttpRequest cannot load https://www.linkedin.com/uas/oauth2/authorization?scope=r_basicprofile+r_em…mZhzisE8BHHksx6bOFDOnxDMKX4dS0&response_type=code&client_id=75l485e9k29snc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.
有没有人遇到过这个问题并想出了如何解决