Display warning message if Internet Explorer uses Compatibility View mode


<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

	<xp:scriptBlock id="scriptBlock1">
		<xp:this.value><![CDATA[
		dojo.addOnLoad(function(){
			// IE8 compat. mode
			if(navigator.userAgent.indexOf("MSIE 7.0") > 0 && navigator.userAgent.indexOf("Trident/4.0") > 0) {
				dojo.style(dojo.byId('IEcompatwarning'), "display", "block");
			}
			// IE9 compat. mode
			if(navigator.userAgent.indexOf("MSIE 7.0") > 0 && navigator.userAgent.indexOf("Trident/5.0") > 0) {
				dojo.style(dojo.byId('IEcompatwarning'), "display", "block");
			}
			// IE10 compat. mode
			if(navigator.userAgent.indexOf("MSIE 7.0") > 0 && navigator.userAgent.indexOf("Trident/6.0") > 0) {
				dojo.style(dojo.byId('IEcompatwarning'), "display", "block");
			}
		});
		]]></xp:this.value>
	</xp:scriptBlock>

	<xp:div>
		<xp:this.loaded><![CDATA[${javascript:context.getUserAgent().isIE()}]]></xp:this.loaded>
		<div id="IEcompatwarning" class="lotusMessage lotusError" style="display: none">
			<img src="/oneuiv2/images/iconError16.png" class="xspImage" />
			<span>
				<table>
					<tbody>
						<tr>
							<td>Internet Explorer has been set to Compatibility View mode. Please turn this off through Tools - Compatibility View Settings.</td>
						</tr>
					</tbody>
				</table>
			</span>
		</div>
	</xp:div>

</xp:view>
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...