cabou
asked on
Check domain before play
Hi experts,
I need to protect a flash movie. so how can I check that it is playing on my server?
Thanks
I need to protect a flash movie. so how can I check that it is playing on my server?
Thanks
That should be...
import flash.external.ExternalInt erface;
var url = = ExternalInterface.call( "function(){return document.location.href;}" ).toString();
if ( url == "http://www.yourdomain.com/containerpage.html" ) {
// yes it is on your own page
} else {
// no it is not on your page
}
import flash.external.ExternalInt
var url = = ExternalInterface.call( "function(){return document.location.href;}" ).toString();
if ( url == "http://www.yourdomain.com/containerpage.html" ) {
// yes it is on your own page
} else {
// no it is not on your page
}
ASKER
ok, but I need to check the domain and not the page
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i tested the new version and it works fine
just put it in ur frist frame and modify it with ur domain name
FLAASHER
just put it in ur frist frame and modify it with ur domain name
FLAASHER
That wont stop users hotlinking to your swf. This will...
var url = ExternalInterface.call( "function(){return document.location.href;}" ).toString();
if ( url.indexOf("www.yourdomain.com") == 7 ) {
// yes it is on your own page
} else {
// no it is not on your page
}
If you have subdomains you'll need to have seperate if statements for them too.
var url = ExternalInterface.call( "function(){return document.location.href;}" ).toString();
if ( url.indexOf("www.yourdomain.com") == 7 ) {
// yes it is on your own page
} else {
// no it is not on your page
}
If you have subdomains you'll need to have seperate if statements for them too.
Thanks for the points
FLAASHER
FLAASHER
if ( _url == "http://www.yourdomain.com/filename.swf" ) {
// yes it is
} else {
// no it isn't
}
To make this work replace "http://www.yourdomain.com/filename.swf" with the full url to your swf (including the quotes)
You will also need to make sure the swf isn't being hot linked from your server....
import flash.external.ExternalInt
var url = = ExternalInterface.call( "function(){return document.location.href;}" ).toString;
if ( url == "http://www.yourdomain.com/containerpage.html" ) {
// yes it is
} else {
// no it isn't
}
To make this work replace "http://www.yourdomain.com/containerpage.html" with the full url to the page holding your swf (including the quotes)