weixin_33724046 2012-09-11 16:10 采纳率: 0%
浏览 53

跨域ajax请求[关闭]

                <div class="grid--cell fl1 lh-lg">
                    <div class="grid--cell fl1 lh-lg">
                        It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and   cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,   <a href="/help/reopen-questions">visit the help center</a>.

                    </div>
                </div>
            </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2012-09-11 17:35:35Z" class="relativetime">7 years ago</span>.</div>
        </div>
    </aside>

Cross domain ajax requests are denied, but I can around it by this:

$(document).ready(function () {
  var data = ...;
  $('<img>').attr('src', 'http://domain.com?data=' + escape(data)).appendTo('body');
});

So if I really want I can send data to another domain. Also I can get data the same way, but on load I can for example move it on canvas and then read pixels.

So what is the point in this restriction and what it can save from?

</div>
  • 写回答

2条回答 默认 最新

  • weixin_33737134 2012-09-11 16:12
    关注

    You still can't read in javascript the pixels of your image when it comes from another domain. So you didn't go around anything.

    A page can't manipulate or even read something coming from another domain without the collaboration of the server. This protects the user from many manipulations (google XSS attacks).

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!