通过flash as识别域名并分别跳转


 手上有两个cn域名,买了一个虚拟主机,想把两个域名都捆在上面。
代码如下:
url1 = "http://www.tutututu.cn";
url2 = "http://tutututu.cn";
if ((_url.substring (0, 20) == url1.substring (0, 20)) || (_url.substring (0, 16) == url2.substring (0, 16)))
{
   getURL("http://www.tutututu.cn/index.html","_self");
}
url3 = "http://www.huisemuma.cn";
url4 = "http://huisemuma.cn";
if ((_url.substring (0, 20) == url3.substring (0, 20)) || (_url.substring (0, 16) == url4.substring (0, 16)))
{
getURL("http://www.huisemuma.cn/index.htm","_self");
}
————————————————————————————————————————
代码参考了(
http://www.blueidea.com/tech/multimedia/2007/4438_3.asp

如果要允许多个域名,可以这样写:
url = "http://www.zhugao.cn";
url2 = "http://zhugao.cn";
if((_url.substring(0, 20)==url) || (_url.substring(0, 16)==url2)){
gotoAndPlay(3);
}else{
gotoAndStop(2);
}
————————————————————————————————————————
发现按照“_url.substring(0, 20)==url”的比较方法是不行的,url同样需要“.substring(0, 20)”
将flash生成url.swf放到网站swf目录,将url.swf嵌入default.html,并且将服务器默认文档“default.html”优先级设置最高。
这样的话,通过两个不同域名可以访问到不同的页面,达到并存的目的。
swf路径为:
/Files/BeyondPic/2008-1/12/url.swf
或者
/Files/BeyondPic/2008-1/12/url.swf
               或者
/Files/BeyondPic/2008-1/12/url.swf
   或者
/Files/BeyondPic/2008-1/12/url.swf
页面的相对路径为:默认页面:default.html    灰色木马的:/index.htm   屠屠兔兔的:/index.html
输入不同域名可测试效果。开始的“无标题文档”的Title是default.html   页面的

url.rar
(4.12 KB)
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyingyongkaifa/559.html

你可能感兴趣的:(html,PHP,Flash,asp,bbs)