jquery - Designing a Play Framework which uses Ajax, but also cares about SEO and graceful degradation -
what way design web app play, provides graceful degradation? working on client application, uses ajax grab partial views, , jquery, put them in place dom.
to support seo , graceful degradation, should either make duplicate controller method, renders partial view part of whole page (header , footer included).so when make call jquery, call "item/12345/partial", bring partial view when user goes "item/12345" should show entire page, partial stuck in.
the second option avoid second controller method, , return full page content (header,javascripts, styles,partial, , footer). when invoked jquery, callback method strip necessary html , fit dom. of course, means same amount of content returned server, reduces advantages of using ajax in first place.
which 1 recommend?
second option not me. use on our project have base template extended ajax parts , these parts have not load rest of template on ajax request:
#{ifnot request.ajax} #{extends 'search-main.html' /} #{/ifnot}
and search-main.html
has #{dolayout /}
in place ajax section should occur if full page going rendered (non ajax request). value in request.ajax
set play, don't have figure out yourself.
about duplicated controllers: should able map 1 controller many urls if needed. add them routes
file. not required in our approach.
Comments
Post a Comment