[英]Why does this JavaScript cause a “Permission Denied” error in IE
以下代碼在IE中引發了Permission Denied
錯誤,引用了jQuery(1.6.2)第6244行Char:2:
function addAgreement() {
var url = window.location.toString();
var pieces = url.split('/');
var site_url = url.replace(pieces[pieces.length -1], '');
$('.login').append('<div id="dialog"></div>');
$('#dialog').load(site_url + '?page_id=443');
}
$('#dialog').dialog({
width: 800,
position: 'top',
modal: true,
buttons: {
"Agree": function() {
agreed = true;
var val = $('#registerform').attr('action') + '&agreed=1';
$('#registerform').attr('action', val);
$(this).dialog("close");
$('#registerform').trigger('submit');
},
"Disagree": function() {
agreed = false;
$(this).dialog("close");
}
}
});
它適用於Firefox - 這與同源策略有關嗎? jQuery由Google CDN提供服務。
更新正在加載的內容是一個WordPress頁面,其中還包含cufon-yui.js
(本地提供)的包含。 我也試過在本地提供jQuery(即不是來自谷歌CDN),這沒有任何區別。
更新2從加載的頁面中刪除以下腳本標記可以阻止錯誤顯示。
<script type='text/javascript' src='<?php echo bloginfo('template_url') ?>/inc/js/cufon-yui.js'></script>
<script type='text/javascript' src='<?php echo bloginfo('template_url') ?>/inc/js/path/to/font.js'></script>
<script type='text/javascript'>
Cufon.replace('#page')('.title');
</script>
對於AJAX請求,www。 被視為子域並打破xmlhttprequestobject的同源策略。 確保AJAX請求中的域與頁面域和javascript文件匹配。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.