A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: document referrer in flash ?

  1. #1
    an old dog learning new tricks
    Join Date
    Feb 2003
    Location
    Devon UK
    Posts
    83

    document referrer in flash ?

    hi,
    is there any way to get the document referrer in flash without passing it through javascript or params. I wan't to prevent deep linking to swf files containing images and guess the best way is for the swf file to check it has been loaded from html which is hosted on my own isp but I don't know how to do that.

    percepts

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    If I understand what you want: prevent other people from using your movies, you can use the _url property of the MovieClip Class:
    code:

    var myURL = "http://www.myDOmain.com";
    var thisURL = this._url;
    if (thisURL.indexOf(myURL) == -1) {
    // not allowed
    }
    else {
    // everything is ok, you can see the movie
    }


  3. #3
    an old dog learning new tricks
    Join Date
    Feb 2003
    Location
    Devon UK
    Posts
    83
    thanks

  4. #4
    an old dog learning new tricks
    Join Date
    Feb 2003
    Location
    Devon UK
    Posts
    83
    just tried this but it's not what I need. Your code would stop someone from copying my movie and putting it on their server but it won't stop them from placing a link to my movie in their website.

    eg. object data="http://www.mydomain.com/mymovie.swf" ....

    percepts

  5. #5
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    I see.
    Using the referer:
    - flash alone can't do it
    - it can be spoofed
    - it may not exist (because of a browser or firewall)

    If you want to try to make sure that the user came from another page, you can set a variable there, or a cookie, or a session, or have a flash movie that creates a SharedObject...

    My webhost also has a feature (that can be enabled in cPanel) to prevent that. Don't know how effective it is.

  6. #6
    an old dog learning new tricks
    Join Date
    Feb 2003
    Location
    Devon UK
    Posts
    83
    there's an option in apache .htaccess file to stop this. It can be used for jpg, gif, swf or any other file type and stops direct retrieval of those files (deep linking) but most isp's won't allow its use because it generates several file access's for every file requested and so slows server performance.
    I guess this is what your cpanel setting does.

    percepts

  7. #7
    an old dog learning new tricks
    Join Date
    Feb 2003
    Location
    Devon UK
    Posts
    83
    the object tag has a variable called BaseHref in the IE DOM which contains the url of the html which the object tag is inside. Is that variable accessible from within flash ?

    e.g object id="objid" data="myswf.swf" ......

    in flash is it possible to access objid.BaseHref in any way?

    percepts

  8. #8
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003

    That I have no idea.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center