[Live-demo] [OSGeo] #833: Redirect if the browser/window is one of the supported

OSGeo trac_osgeo at osgeo.org
Thu Nov 17 10:51:52 EST 2011


#833: Redirect if the browser/window is one of the supported
-------------------------+--------------------------------------------------
 Reporter:  fgdrf        |       Owner:  live-demo@…              
     Type:  enhancement  |      Status:  new                      
 Priority:  minor        |   Milestone:                           
Component:  LiveDVD      |    Keywords:                           
-------------------------+--------------------------------------------------
 in case of the browser has set en, de, el, jp, es or pl the relevant index
 page should be loaded by redirecting. IMHO this should only happen if the
 user came from an other side .

 Its possible to achieve this behavior by adding a javascript right under
 'doc/_static/<path>/<the_java_script_file.js>' and register it in the
 python script conf.py by the following additional lines:

 {{{
 def setup(app):
     app.add_javascript('<path>/<the_java_script_file.js>')
 }}}

 the js-File can access the language environment:
 {{{
 var supported_languages=["el", "es", "pl", "en", "de", "jp"];

 var langCode = navigator.language || navigator.systemLanguage;
 var lang = langCode.toLowerCase();
 lang = lang.substr(0,2);

 // check last page and if it's not live.osgeo.org and
 // browser language is one of the supported and
 // requested page was index.html,
 // redirect to the relevant <lang>/index page
 // TODO code here
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/osgeo/ticket/833>
OSGeo <http://www.osgeo.org/>
OSGeo committee and general foundation issue tracker.


More information about the Live-demo mailing list