4

How can I detect in my webpage using javascript if the user is using a browser with RTL language? For example Arabic. I want to provide a different layout for them.

  • possible duplicate of [JavaScript: how to check if character is RTL?](http://stackoverflow.com/questions/12006095/javascript-how-to-check-if-character-is-rtl) – gtournie Jan 28 '14 at 23:46

1 Answers1

4

I might be missing something, but since it's your webpage/server that ultimately decides whether to display/send Arabic text or not can't you use the browser language preference to also provide a different layout?

JavaScript for detecting browser language preference

Community
  • 1
  • 1
Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
  • 1
    Yeah, client info on server side is the best way, Most i18n/l10n libs/framworks, provide a away to check if a specific language is RTL or not. – user.dz Jan 29 '14 at 12:30