如何从代码隐藏中的javascript函数中检索值,在页面加载时... javascript函数如:
<script type="text/javascript">
function isIFrame() {
var isInIFrame = (top.location != self.location);
if (isInIFrame) {
return "inside";
}
else {
return "outside";
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
和代码背后像:
protected void Page_Load(object sender, EventArgs e)
{
string resutOfExecuteJavaScript = "";
// resutOfExecuteJavaScript = isIFrame(); // from javascript
if (resutOfExecuteJavaScript == "inside")
{
// do something
}
else
{
// do something
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.