In my Drupal 7 site I have a view with two block displays. The only difference between both is one filter criteria -URL Aias-: one block shows content with "/html5" in its alias and the other shows "/flash" url aliased content
Those blocks must be dispalyed only on certains pages. This logic is controlled by Context module based on the URL. In this way, the block will be showed if the URL is like "perm/type/man/*"
At this URL I need to display one block or another depending on flash content is enabled or not at device level: if device support flash (like PC) the flash content must be dislayed. If device doesn't support flash (mobile), the html5 content will be shown.
I found this js code to detect if flash is enabled on the device
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) {
hasFlash = true;
}
} catch (e) {
if (navigator.mimeTypes
&& navigator.mimeTypes['application/x-shockwave-flash'] != undefined
&& navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
hasFlash = true;
}
}
but I don't know what to do with it nor where I must include the code.
Can you help me?
You may try to add the above code into a file or as an inline script with drupal_add_js
and continue as follows: