www.webdeveloper.com
Results 1 to 6 of 6

Thread: Get the Current URL

  1. #1
    Join Date
    Dec 2002
    Posts
    177

    Get the Current URL

    My site uses ASP with Javascript.

    I have a Feedback hyperlink, which can be clicked from the footer on every page. The idea is to get feedback from any page on the website.

    When you click on the Feedback link, a PopUp Window opens and has a form for users to fill out and then insert into DB.

    On the form, there's a Hidden Field which should include the URL of the page it was launched from, so that we know which page the user has left feedback for.

    How can I get the URL of the page?

    Thank you!
    Brachole
    Web Development
    fcoloccia(at)prostatcorp.com

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    It should be in
    Code:
    window.opener.location

  3. #3
    Join Date
    Dec 2002
    Posts
    177
    Not sure this is what I need.

    My first page called Home.asp looks like:

    Code:
    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <script language="">
    function openFeedback(){
    var popurl="Feedback.asp"
    winpops=window.open(popurl,"","width=615,height=550,scrollbars")
    }
    </script>
    
    <body>
    <a href="javascript:openFeedback()">Click here to leave feedback about this page</a> 
    </body>
    </html>
    My Second page called Feedback.asp looks like this:

    Code:
    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <form name="form1" method="post" action="">
      <input name="URL" type="hidden" id="URL">
      <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    </html>
    When I click the "Click here to leave..." link from the Home.asp page, it opens Feedback.asp and writes the URL of Home.asp (www.mysite.com/Home.asp) inside the hidden field on feedback.asp.

    How can I do this?
    Brachole
    Web Development
    fcoloccia(at)prostatcorp.com

  4. #4
    Join Date
    Mar 2006
    Posts
    591
    I think it can be done by document.referrer. But I'm not sure I'll have to check

  5. #5
    Join Date
    Dec 2002
    Posts
    177
    Terrorke, dosument.referrer will not work when opening a PopUp window...
    Brachole
    Web Development
    fcoloccia(at)prostatcorp.com

  6. #6
    Join Date
    Aug 2007
    Posts
    295
    Try opener.location.href or perhaps winpops.opener.location.href
    Last edited by harumph; 10-24-2007 at 09:39 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles