Results 1 to 6 of 6

Thread: Location Object In JavaScript

  1. #1
    Join Date
    Nov 2009
    Posts
    680

    Location Object In JavaScript

    Hello, I am learning JavaScript and want to get some of the details about the different objects used in the java script. I have some of the details about the Location Object in JavaScript, but it is not enough to get the exact knowledge about it, so if anyone is having more information about it, then please provide me that, so that I can able to know the concept behind it. I will be thankful to you if you reply me. It will help me to get more programming knowledge.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Location Object In JavaScript

    Location Object is the built in object provided by the Javascript for the user. If you are making use of the location object in your code then you can able to get the details about the Url which are now loaded. It can include the host name, port and protocol. You can able to get complete details about the particular url with the use of this object.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Location Object In JavaScript

    Location Object In JavaScript used as below mentioned:
    Code:
    <script type="text/javascript">
            function Location()
            {
                for (var property in location)
                {
                    document.getElementById("txtURL").value += property + "-->" + ((location[property] == "") ? "Not Present" : location[property]) + "\r\n";
                }
            }
            function again()
            {
                location.reload();
            }
            function Further()
            {
                location.assign("NewPage.aspx?Name=YYY");
            }
            function Details ()
            {
                if (location.search)
                {
                    var arg = location.search.split('&');
                    for (var i = 0; i < arg.length; i++)
                    {
                        var args = arg[i].split('=');
                        alert(args[0].toString().replace('?', '') + ":" + args[1]);
                    }
                }
            }
    </script>

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

    Re: Location Object In JavaScript

    If you are using the Location Object in JavaScript then you will able to get the following properties and methods:
    Properties:
    • host
    • hostname
    • href
    • pathname
    • port
    • protocol
    • search

    Methods:
    • reload()
    • assign()

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

    Re: Location Object In JavaScript

    If you are making use of the Location object in your Javascript then you may get the all the detailed information about the current URL. You can make use of the string below for the representation.
    Code:
     <protocol>//<host>[:<port>]/<pathname>[<hash>][<search>]
    The location object has a many properties and methods in it. If you want to know details about it then you must need to make use of the different tutorials and books for it.

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    Re: Location Object In JavaScript

    Location contains information about the current URL of the browser. You can make use of it as simply as below mentioned:
    Code:
    <script type="text/javascript">
    window.location="http://www.techarena.in"
    </script>
    Location Object Properties:
    • hash
    • host
    • hostname
    • href
    • pathname
    • port
    • protocol
    • search

    Location Object Methods:
    • assign()
    • reload()
    • replace()


    Location object is the client side object which is created by the browser and the interface is implemented in JavaScript since version 1.0.

Similar Threads

  1. How to setup a JavaScript Object Notation variable?
    By hatred in forum Software Development
    Replies: 4
    Last Post: 04-02-2010, 02:25 AM
  2. Date Object In Javascript
    By Level8 in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 12:07 PM
  3. JavaScript - The window object
    By Sheenas in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 11:38 AM
  4. History Object In JavaScript
    By ramsun in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 10:17 AM
  5. JavaScript: RegExp and Boolean Object
    By Ivann in forum Software Development
    Replies: 5
    Last Post: 18-12-2009, 03:36 AM

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,713,561,416.40014 seconds with 16 queries