Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect whether browser shows <select multiple> as modal dialog

Is there any way to use JavaScript to detect whether a given browser renders a focused <select multiple> element as a popup or solely as an inline box?

On some platforms, such as the Android Browser and iOS Safari, the use of a popup can be detected by comparing the heights of, say,

<select multiple>
  <option>a</option>
  <option>a</option>
  <option>a</option>
  <option>a</option>
  <option>a</option>
<select>

and

<select multiple>
  <option>a</option>
<select>

The heights are the same because the <select>s get reduced to a single box with a dropdown button. But on other devices, such as the Playbook, this test would give a false negative, since the Playbook browser renders expanded select lists and shows popups when they're clicked.

Can anyone think of a reliable way to determine whether a native select popup is shown?

like image 587
kpozin Avatar asked Jul 18 '11 20:07

kpozin


1 Answers

It looks like masedesign is leading toward this, but I'm going to go one step further:

Perhaps detect mobile browsers vs non-mobile browser (eg. RIM, Android, iOS, etc VS FF, Chrome, Opera, Safari, IE, etc)

like image 165
Jacksonkr Avatar answered Sep 18 '22 06:09

Jacksonkr