Base Name from A Current URL using javascript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sarfaraz
    New Member
    • Aug 2006
    • 2

    Base Name from A Current URL using javascript?

    Hi,
    i am trying to findout the base URL from Current URL
    I can get the Current Address by using Location.href
    For Example:
    by Location.href i got the Url as www.assurejobs. com/eappHR/PostResume.do?o peration=someth ing
    from this URL i need to find out the BaseURL upto the eappHR
    i.e upto the www.assurejobs. com/eappHR/ this should be done by making use of the javascript
    any suggestions please ..
    thanks in advance
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    [code=javascript]location.href.s ubstring(0,loca tion.href.lastI ndexOf("/")+1)[/code]

    Comment

    Working...