Results 1 to 4 of 4

Thread: Return the title, URL and referrer in JavaScript document

  1. #1
    Join Date
    Sep 2009
    Posts
    135

    Return the title, URL and referrer in JavaScript document

    There is an assignment which has been assigned to me to be completed within this week. This assignment includes some JavaScript programs which I am not able to solve. The programs for returning the title of document, returning the URL and returning the referrer are really tough to program for me in JavaScript. Please provide me with the logic to solve these programs. I have tried many codes but all end up with errors only rather than the desired output.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Return the title, URL and referrer in JavaScript document

    Here is code that will help you to fetch the URL of the document and display it to the reader. The scripting used here is JavaScript. The document.write(document.URL) is the actual piece of code the fetches the document's URL and outputs in on the reader's screen.
    Code:
    <HTML>
    <BODY>
    <HEAD> 
    <TITLE>URL Fetching</TITLE>
    <HEAD>
    <SCRIPT type="text/javascript">
    document.write(document.URL);
    is the document's URL.
    </SCRIPT>
    </BODY>
    </HTML>

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Return the title, URL and referrer in JavaScript document

    I was also given a program to display the title of the document using JScript. The title of the document was Learning JScript. I had to output this title in a sentence as Learning JScript is the Title of the this document. I wrote the following code to display the required output:
    Code:
    <html>
    
    <HEAD>
    <TITLE>Learning JScript</TITLE>
    </HEAD>
    
    <body>
    
    <script type="text/javascript">
    document.write(document.title);
    is the Title of the this document.
    </script>
    
    </body>
    
    </html>

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Return the title, URL and referrer in JavaScript document

    Code:
    This document is referred by:
    <script type="text/javascript">
    document.write(document.referrer);
    </script>
    Use the above code in your Javascript program between the <body> and </body> tags. This code will help you to give the referrer's URL to the user. A referrer is a document's URL that loaded the current document.

Similar Threads

  1. Having problem setting document title in MS Word 2010
    By Abi.RauT in forum Windows Software
    Replies: 1
    Last Post: 30-04-2012, 06:55 PM
  2. Replies: 8
    Last Post: 17-03-2012, 10:37 AM
  3. php get domain from referrer
    By Seducer in forum Software Development
    Replies: 4
    Last Post: 11-05-2010, 01:40 PM
  4. Problems of SharePoint Document Auto Title in Windows 7
    By Amma-Watson in forum Operating Systems
    Replies: 5
    Last Post: 07-02-2010, 04:24 AM
  5. How to Automate PDF document Using JavaScript
    By VinFanatic in forum Software Development
    Replies: 3
    Last Post: 13-04-2009, 02:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,368,745.79076 seconds with 16 queries