Need URL of current page of browser

Posted on 2006-05-04
Last Modified: 2012-05-05
I need to get the URL string from the page which contains the current SWF.
Question by:Donelson
    LVL 5

    Accepted Solution

    Have added this comment to your other posts too

    getURL("javascript:window.document.testSWF.SetVariable('strURL', document.location.href);");

    where testSWF is your movie name and strURL is the variable in which you would get the value.

    getURL function is asynchronous so you might want to loop frames with a check for strURL != undefined.



    Author Comment

    Wings --

    Absolutely Brilliant !  Elegant, succinct, reliable!  Five-Stars for this perfect solution!

    After spending 11 hours searching, begging, trying weird and sometimes awful solutions, this is truly EXCELLENT.

    All points to the Expert Extraordinaire !

    Author Comment

    ----------- TYPICAL USAGE ---------


    getURL("javascript:window.document.myMovieSwf.SetVariable('pageURL', document.location.href);");

    intID = setInterval(this, "check_url", 250);

    function check_url() {
          if (pageURL == undefined) return;
          clearInterval(intID);      // Be sure to stop this when we've got an answer
          theArgs = pageURL.split("?")[1];      // get second part of URL
          if (theArgs.length > 0) {
                // do whatever you want with the args

    Author Comment


    WIngs --

    I very much appreciate the test page -

    I use Macintosh extensively and have found this information for you to add to the TEST table

    Macintosh OSX 10.4.x --

         Safari 2.0.3 - Movie plays once then stops for methods (1, 2, 3, and 5). No play for (4 & 6).

         FireFox - Movie plays once then stops for methods (1, 2, 4 and 6).
         No play for 3, which gives dialog "movie object not found. No play for 5.

         Internet Explorer 5.2.3 (no longer supported by MicroSoft on Mac)
         No play for any test.

    William Donelson

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    The goal of the tutorial is to teach the user how to how to record live broadcast.
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now