Why can't you just use "document.location.pathname"?
http://developer.mozilla.org/en/docs/DOM:window.location

- kangax

On May 22, 5:57 am, azymuth <[EMAIL PROTECTED]> wrote:
> My app often needs to know the page name to pass to Google Analytics
> and various other uses.  Hence, 
> fromhttp://dev.myapp.com/controller/action/value/
> I want to get back the string "/controller/action/value/" for further
> manipulation (I need to ignore the domain).
>
> I can do this as follows:
> var Url = {
>         getPage: function() {
>                 var segments =
> document.location.href.split('/').slice(3).findAll(function(x){
>                         return !x.empty()
>                 });
>                 return '/'.segments.join('/').'/';
>         }}
>
> document.location.getPage = Url.getPage;
>
> but I reckon there must be a more elegant way - can someone tell me
> what it is?  Does prototype have anything special to say about
> document.location and it's properties?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to