Web Analytics Made Easy -
StatCounter open URL to check where it redirects - CodingForum

Announcement

Collapse
No announcement yet.

open URL to check where it redirects

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • open URL to check where it redirects

    Hi there!
    this is my situation:

    1. open window with specified URL that points to external website.
    2. the external website is redirected to another URL by script of that website.
    3. get the URL the website was redirected to.

    The problem is in points 2 and 3. How javascript might recognize if website is already reloaded, so it can get the new URL of it?

    I tried to do something like that:

    while (!newwindow.location)
    { }
    newurl=newwindow.location.href;

    but it returns address of blank page. Also tried to use:

    <META HTTP-EQUIV="refresh" CONTENT="5; URL='+url+'">

    in new window - no reaction.

    Any answer would be very appreciated

  • #2
    Once the browser is in another domain, you will not be able to access it without security warnings.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

    Comment


    • #3
      I didnt receive any warnings. I use IE/FF. Might this problem be solved in any way? What do you think?

      Comment


      • #4
        OK, I rebuilt script and now it tries to search web content.
        I put external page into frame, I search it using:

        parent.frames[0].find();

        And I get the warning:

        Error: uncaught exception: Permission denied to get property Window.find

        I suppose this is what you were talking about.
        is there any solution to search external webpage content?

        thanks for any help.
        Last edited by phpworker; Aug 1, 2005, 07:23 AM.

        Comment


        • #5
          by adding an onload handler to the window you can get the redirected url after the page has reloaded. i don't think getting the url will be a problem accessing the document will be.
          You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

          Comment


          • #6
            Originally posted by shyam
            i don't think getting the url will be a problem accessing the document will be.
            That's still inaccessible. Try this:

            Code:
            <iframe name="gg" src="http://www.google.com/"></iframe>
            <input type="button" value="Get URL" onclick="alert(parent.frames['gg'].location.href);" />
            For security reasons, you don't have access to any property of an external site in a frame/iframe/new window.
            Glenn
            vBulletin Mods That Rock!

            Comment


            • #7
              OK, Thanks for help. I try tu use php...


              Comment

              Working...
              X