A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: get domain name

  1. #1
    Webmong
    Join Date
    Mar 2004
    Location
    London UK
    Posts
    24

    get domain name

    hi all

    is there a way of flash getting the domain that its located on.

    e.g.

    http://www.blabla.com/site.html (which has my swf embeded)

    from this my swf can get the variable 'blabla.com'

    somthing like the PHP: $_SERVER["SERVER_NAME"]

    I hope this makes sence.

    Cheers
    Chris

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    PHP Code:
    // Gets the IP Address
    if ($REMOTE_ADDR == ""$ip "no ip";
    else 
    $ip getHostByAddr($REMOTE_ADDR); 

  3. #3
    Webmong
    Join Date
    Mar 2004
    Location
    London UK
    Posts
    24
    Is that PHP or actionscript?

    I need to do this with actionscript without using any PHP.

    Can it be done?

    Chris

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    It's PHP, I don't know of any way to get it in flash.

  5. #5
    Living Proof mave_the_rave's Avatar
    Join Date
    May 2002
    Location
    East Dulwich
    Posts
    1,006
    I asked this question a week ago.

    try these. You may need to adapt them for your use.

    code:
    <!-- Begin
    document.write("<B>Thanks for visiting us from ");
    document.write(document.referrer+"</B>");
    // End -->
    </script>


    code:


    <script language="Javascript">
    <!--
    // please keep these lines on when you copy the source
    // made by: Nicolas - http://www.javascript-page.com

    if (document.referrer&&document.referrer!="")
    document.write('Thanks for visiting this site from '+document.referrer+'<BR>');

    //-->
    </script>

    If someone tells you it can't be done,
    it's probally because they don't know how.

  6. #6
    Junior Member
    Join Date
    Aug 2002
    Posts
    6
    This should do it:

    var localDomainLC:LocalConneciton = new LocalConnection();
    myDomainName = localDomainLC.domain();
    trace( "My domain is " + myDomainName );

  7. #7
    Junior Member
    Join Date
    Oct 2003
    Posts
    4
    however:

    localconnection.domain() will not necessarily return the domain of the .swf;

    it will return the domain of the webpage that is embedding the .swf;

    example:
    html abbreviated code of www.blah.com:
    Code:
    <object/embed src = "www.fatmomma.com/my.swf" >
    actionscript code:
    Code:
    var localDomainLC:LocalConneciton = new LocalConnection();
    myDomainName = localDomainLC.domain();
    trace( "My domain is " + myDomainName ); // returns www.blah.com
    //                                                       //  but not 
    //                                                       // www.fatmomma.com


    dsdsdsdsd

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