【发布时间】:2013-12-31 03:49:43
【问题描述】:
您好,我的脚本有问题。我认为这与位置有关...在所有浏览器中都可以正常工作。但是,当此脚本在 facebook 应用程序 (Iframe) 中运行时,它不会触发 Internet Explorer 中的函数 postbackhiddenfield。它适用于所有其他浏览器...
有人给点建议吗?
<html xmlns="https://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
// Changing the value of the hidden field forces the page to postback
// and executes the hdnUpdater_ValueChanged() procedure on the code behind
function postBackHiddenField(hiddenFieldID) {
//var hiddenField = $get(hiddenFieldID);
var hiddenfield = document.getElementById(hiddenFieldID)
if (hiddenField) {
hiddenField.value = (new Date()).getTime(); __doPostBack(hiddenFieldID, '');
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<!-- The acess_token is stored...//-->
<asp:HiddenField ID="hdnAccessToken" runat="server" />
<!-- The control that postbacks the access_token...//-->
<asp:HiddenField ID="hdnUpdater" runat="server" />
<!-- The script that grabs the access_token in the hash, stores the access_token in the
'hdnAccessToken', and postbacks the value for JSON retrieval and decoding...//
window.frameElement.contentWindow.location.hash
-->
<script type="text/javascript">
if (window.location.hash.length != 0) { // Check if there's a hash on the URI
accessToken = window.location.hash.substring(1); // Retrieve the access_token
document.getElementById('hdnAccessToken').value = accessToken; // Store the access_token
//postBackHiddenField('hdnUpdater'); // Postback the page
__doPostBack('hdnUpdater', '')
}
</script>
</form>
</body>
【问题讨论】:
标签: javascript html asp.net facebook iframe