我有嵌入在HTML文件中的SWF:如何防止swf創建自己的會話ID?
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>v2</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" media="screen">
html, body { height:100%; background-color: #ffffff;}
body { margin:0; padding:0; overflow:hidden; }
<!--#wrapper { width:100%; height:100%;}
#flashContent { width:100%; height:100%; margin-right:auto; margin-left:auto; text-align:center;}-->
</style>
<script language="javascript">AC_FL_RunContent = 0;
</script>
<script src="/AC_RunActiveContent.js" language="javascript"></script>
<script language="javascript">
function backfunc(arg){
window.location.replace(arg);
}
</script>
<head>
<body>
<script language="javascript">
var flashpath = '{{song.flashURL}}' + '?date=' + new Date().getTime();
var songId = {{song.id}};
var vars = 'username={{current_user.first_name}} {{current_user.last_name}}' + '&' +
'songid={{song.id}}' + '&' +
'sessionid={{session_id}}';
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=11,0,0,0',
'width', '640',
'height', '480',
'src', flashpath,
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'false',
'scale', 'default',
'wmode', 'window',
'flashVars',vars,
'devicefont', 'false',
'id', '{{song.flashURL}}',
'bgcolor', '#ffffff',
'name', '{{song.flashURL}}',
'menu', 'true',
'allowFullScreen', 'true',
'allowScriptAccess','sameDomain',
'movie', flashpath,
'salign', ''
); //end AC code
}
</script>
</body>
</html>
我在我的SWF一個按鈕,調用javascript函數的頁面重定向到主頁。 AS3和JS代碼的優勢如下: AS3:
if(ExternalInterface.available){
txt.text = url;
ExternalInterface.call("backfunc",url);
}
else{
txt.text = "ex int not available";
}
JS:
function backfunc(arg){
window.location.replace(arg);
}
當我做此操作時,會出現問題。問題是,當主頁加載時,我看到了舊的註銷用戶的頁面,因爲Flash會保留舊的和死的會話ID。因此,由於swf,我無法僅管理瀏覽器和服務器之間的會話。我該如何解決這個問題。我一直在谷歌和這裏搜索2周,最後我決定寫在這裏。提前致謝。
我不認爲Flash知道會話的任何內容。 – 2013-04-30 16:14:06