如何正确处理 Silverlight 弃用问题?
How to properly deal with Silverlight deprecation?
最近Chrome deprecated NPAPI support, so that means no Silverlight. Now, I've learned to be a good web developer and prefer feature detection over browser detection to deliver a good user experience. Unfortunately, it seems impossible做NPAPI支持功能检测。
我已经构建了一个 JavaScript 替代我们的 Silverlight 工具。我最初使用 conditional comments 检查用户是否使用 IE9 或更早版本,这是一种可靠的方法(如果我错了请纠正我)。在那种情况下,我会为他们提供 Silverlight 工具。假设其他浏览器支持所有必要的功能(在这种情况下我们只针对桌面浏览器),因此它们可以使用新的 JS 工具。
经过测试,发现IE10和IE11速度太慢,无法很好地处理我们的应用程序。特别是一些 I/O 操作 (MD5 hashing and DICOM parsing) are approx. 10-15x slower. I thought I'd then just serve ALL versions of IE the Silverlight tool, but conditional comments are no longer supported in IE10+.
我很伤心。看来我毕竟不得不求助于不可靠的浏览器检测。我唯一的选择似乎是 testing if the JS engine is slow 但这似乎也不可靠。所以我求助于 Whosebug 的好人;怎么办?
很遗憾没有人提出更好的建议。最后,我能够为我们的 Silverlight 控件编写一个纯粹的 JavaScript 替代品。由于 IE10 和 IE11 对于 I/O 操作的性能仍然很差,我决定检测它们以回退到 Silverlight 控件。
<!--[if IE]>
<script type="text/javascript">
window.is_ie = true;
</script>
<![endif]-->
<script type="text/javascript">
function isIE(ua) {
if (ua.indexOf('MSIE ') > -1)
return true;
if (ua.indexOf('Trident/') > -1)
return true;
return false;
}
if(!window.is_ie) {
window.is_ie = isIE(window.navigator.userAgent);
}
</script>
最近Chrome deprecated NPAPI support, so that means no Silverlight. Now, I've learned to be a good web developer and prefer feature detection over browser detection to deliver a good user experience. Unfortunately, it seems impossible做NPAPI支持功能检测。
我已经构建了一个 JavaScript 替代我们的 Silverlight 工具。我最初使用 conditional comments 检查用户是否使用 IE9 或更早版本,这是一种可靠的方法(如果我错了请纠正我)。在那种情况下,我会为他们提供 Silverlight 工具。假设其他浏览器支持所有必要的功能(在这种情况下我们只针对桌面浏览器),因此它们可以使用新的 JS 工具。
经过测试,发现IE10和IE11速度太慢,无法很好地处理我们的应用程序。特别是一些 I/O 操作 (MD5 hashing and DICOM parsing) are approx. 10-15x slower. I thought I'd then just serve ALL versions of IE the Silverlight tool, but conditional comments are no longer supported in IE10+.
我很伤心。看来我毕竟不得不求助于不可靠的浏览器检测。我唯一的选择似乎是 testing if the JS engine is slow 但这似乎也不可靠。所以我求助于 Whosebug 的好人;怎么办?
很遗憾没有人提出更好的建议。最后,我能够为我们的 Silverlight 控件编写一个纯粹的 JavaScript 替代品。由于 IE10 和 IE11 对于 I/O 操作的性能仍然很差,我决定检测它们以回退到 Silverlight 控件。
<!--[if IE]>
<script type="text/javascript">
window.is_ie = true;
</script>
<![endif]-->
<script type="text/javascript">
function isIE(ua) {
if (ua.indexOf('MSIE ') > -1)
return true;
if (ua.indexOf('Trident/') > -1)
return true;
return false;
}
if(!window.is_ie) {
window.is_ie = isIE(window.navigator.userAgent);
}
</script>