Thursday 15 September 2011

javascript - Display one Drupal block or another if flash is enabled -



javascript - Display one Drupal block or another if flash is enabled -

in drupal 7 site have view 2 block displays. difference between both 1 filter criteria -url aias-: 1 block shows content "/html5" in alias , other shows "/flash" url aliased content

those blocks must dispalyed on certains pages. logic controlled context module based on url. in way, block showed if url "perm/type/man/*"

at url need display 1 block or depending on flash content enabled or not @ device level: if device back upwards flash (like pc) flash content must dislayed. if device doesn't back upwards flash (mobile), html5 content shown.

i found js code observe if flash enabled on device

var hasflash = false; seek { var fo = new activexobject('shockwaveflash.shockwaveflash'); if (fo) { hasflash = true; } } grab (e) { if (navigator.mimetypes && navigator.mimetypes['application/x-shockwave-flash'] != undefined && navigator.mimetypes['application/x-shockwave-flash'].enabledplugin) { hasflash = true; } }

but don't know nor must include code.

can help me?

you may seek add together above code file or inline script drupal_add_js , go on follows:

load both blocks on same page initialy hidden , show 1 meets conditions in js. or load right block's content ajax , dump dom based on desired criteria.

javascript html5 flash drupal-7 drupal-views

No comments:

Post a Comment