嘿嘿。我有一个我正在开发的 Flash 应用程序,它可以嵌入到其他网站(如 YouTube 视频)中,但我们想知道用户正在哪个网站上查看该网站。有什么方法可以告诉用户正在查看应用程序嵌入在哪个网站上?
如果有帮助,原始应用程序是用 flash/actionscript 和在服务器上运行的 php 编写的。谢谢。
您可以简单地通过 php 检索HTTP 引用标头,将其存储在某处,然后提供您的 Flash 内容...
<?php
// served from http://yoursite.net/your_flash.php
//read the referer header
$referer_url = (isset($_SERVER['HTTP_REFERER']))? $_SERVER['HTTP_REFERER'] : "";
//store it somewhere...
//read the swf file
$swf=file_get_contents('flash_app.swf');
//spit the flash content out with the proper header
header('Content-type: application/x-shockwave-flash');
echo $swf;
?>
嵌入代码,由第三方网站在其 HTML 中粘贴:
<object width="550" height="400">
<embed src="http://yoursite.net/your_flash.php" width="550" height="400">
</embed>
</object>