Web Analytics Made Easy -
StatCounter Favlet domain regEx - CodingForum

Announcement

Collapse
No announcement yet.

Favlet domain regEx

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

  • Favlet domain regEx

    What i am trying to do is this:

    Code:
    var url= escape(document.location);
    var domain = url.match( /:\/\/(www\.)?([^\/:]+)/ ); 
    document.location="http://" + domain + "/backend/"
    
    javascript:var url= escape(document.location); var domain = url.match( /:\/\/(www\.)?([^\/:]+)/ ); document.location="http://" + domain + "/backend/"
    - Grab the current url
    - Filter it down to just a domain name
    - Add foldername, and jump tu the new url.

    But it fails everytime, returning null from the regex ...

    Does someone have a clue why this aint working in a favlet ?

  • #2
    Could you not use something like this mate?:
    Code:
    javascript: window.location.replace(window.location.protocol+"//"+window.location.hostname+"/backend/);
    changing the /backend/ to whatever folder you wanted

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

    Comment

    Working...
    X