If I do a link_to ''XYZ'', ''/usage/Faq.html#GB_limit'' in my view ... can I detect "GB_Limit" in my controller? Where? I know I can do link_to ''XYZ'', ''/usage/Faq.html?bookmark=GB_limit'' and I can find GB_limit in params[:bookmark]. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ralph Shnelvar wrote in post #969900:> If I do a > link_to ''XYZ'', ''/usage/Faq.html#GB_limit'' > in my view ... > > can I detect "GB_Limit" in my controller?Not to my knowledge. I believe -- and I hope someone will correct me if I''m wrong -- that the browser removes the #fragment section of the URL, and merely does a HTTP GET ''/usage/Faq.html'', so that the server never even sees the #fragment. Therefore, the only way I''m aware of to process the #fragment is to use client-side JavaScript. (BTW, you should really be using lowercase for your HTML filenames, or else you''re likely to run into case sensitivity issues.)> Where? > > I know I can do > link_to ''XYZ'', ''/usage/Faq.html?bookmark=GB_limit'' > and I can find GB_limit in params[:bookmark].Right. The ?query=string is meant for the server. The #fragment is meant for the client. That''s just how HTTP URLs work. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Dec 21, 2010 at 3:53 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> (BTW, you should really be using lowercase for your HTML filenames, or > else you''re likely to run into case sensitivity issues.)I used to think that too, but then I tested it a few months back and found every browser I tried worked fine with incorrect case in a URL. http://example.com/Home.html worked when the actual URL was http://example.com/home.html I still go all lowercase just out of habit.. looks cleaner too. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald wrote in post #969911:> On Tue, Dec 21, 2010 at 3:53 PM, Marnen Laibow-Koser > <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> (BTW, you should really be using lowercase for your HTML filenames, or >> else you''re likely to run into case sensitivity issues.) > > I used to think that too, but then I tested it a few months back and > found every browser I tried worked fine with incorrect case in a URL. > > http://example.com/Home.html worked when the actual URL was > http://example.com/home.html > > I still go all lowercase just out of habit.. looks cleaner too.AFAIK this is server-dependent, not browser-dependent -- that is, some servers are case-sensitive and some are not. For example, my website is hosted on a case-sensitive server (Apache on some sort of *nix). I just tried typing in http://www.marnen.org/Music.html and got an error (Firefox 3.6, Mac OS X 10.6). http://www.marnen.org/music.html , however, gives the expected page. Do you get different results? If so, in what browser? It''s best to always treat your server (and browser) as if they''re case-sensitive.> > > -- > Greg Donald > destiney.com | gregdonald.comBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think if you really need to pass the (window.location.hash) to the
server when you have to go with JavaScript.
In your case since you have a bookmark inside the link href, I would
create a custom XHR request with passing a bookmark as a GET
parameter.
I hope that something like this can be helpful to you:
jQuery(function($) {
$(''#your_special_link_with_bookmark'').click(function() {
var href = this.href;
$.get(href, {''bookmark'' :
href.substr(href.indexOf(''#'') + 1)})
})
})
I didn''t test the example, but something like this is a very small
hack and you can adjust it to your needs.
--
Thanks, Ivan Povalyukhin
On Dec 21, 2:16 pm, Marnen Laibow-Koser
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> Greg Donald wrote in post #969911:
>
> > On Tue, Dec 21, 2010 at 3:53 PM, Marnen Laibow-Koser
> > <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
> >> (BTW, you should really be using lowercase for your HTML
filenames, or
> >> else you''re likely to run into case sensitivity issues.)
>
> > I used to think that too, but then I tested it a few months back and
> > found every browser I tried worked fine with incorrect case in a URL.
>
> >http://example.com/Home.htmlworked when the actual URL was
> >http://example.com/home.html
>
> > I still go all lowercase just out of habit.. looks cleaner too.
>
> AFAIK this is server-dependent, not browser-dependent -- that is, some
> servers are case-sensitive and some are not.
>
> For example, my website is hosted on a case-sensitive server (Apache on
> some sort of *nix). I just tried typing
inhttp://www.marnen.org/Music.htmland got an error (Firefox 3.6, Mac OS X
> 10.6). http://www.marnen.org/music.html, however, gives the expected
> page. Do you get different results? If so, in what browser?
>
> It''s best to always treat your server (and browser) as if
they''re
> case-sensitive.
>
>
>
> > --
> > Greg Donald
> > destiney.com | gregdonald.com
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.