How do I make absolute url's trigger my handlers?

100 views
Skip to first unread message

Paul Biggar

unread,
Aug 11, 2012, 1:45:39 PM8/11/12
to sam...@googlegroups.com
I've got a handler like this:

    @get('/docs(.*)', (cx) -> myFunc cx)

When I click on a relative url to '/docs', this fires, for example with a link like this: <a href="/docs">docs</a>

However, when I have a absolute url to 'https://mysite.com/docs', this doesn't file, for example with: <a href="https://mysite.com/docs">

Any ideas how I can make it fire for an absolute link as well?

Thanks,
Paul

Aaron Quint

unread,
Aug 13, 2012, 2:45:59 AM8/13/12
to sam...@googlegroups.com
The Sammy router only matches on the path and not on hostnames:

https://github.com/quirkey/sammy/blob/master/lib/sammy.js#L253

It should however recongnize any URLs that point to the same host as
the one you are on:

https://github.com/quirkey/sammy/blob/master/lib/sammy.js#L279

--AQ
> --
> You received this message because you are subscribed to the Google Groups
> "Sammy.js" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sammyjs/-/8qJoKpM4mb0J.
> To post to this group, send email to sam...@googlegroups.com.
> To unsubscribe from this group, send email to
> sammyjs+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sammyjs?hl=en.

raulc

unread,
Aug 16, 2012, 2:26:03 PM8/16/12
to sam...@googlegroups.com
Paul, i noticed that your urls are https.

maybe you load your page over http and then you switch to https, i am not sure if "hashchange" triggers then.
Reply all
Reply to author
Forward
0 new messages