2012-12-05 73 views
1

有一個不錯的插件QR Code:「https://github.com/lrsjng/jQuery.qrcode」。在Firefox和Chrome中工作成功,但在Internet Explorer 8.0中出現錯誤:jQuery qrcode不適用於Internet Explorer 8

此行的消息是:「對象不支持此屬性或方法」。

完整的代碼是:

<!DOCTYPE html> 
<html> 
    <head> 
     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> 
     <script type="text/javascript" src="../jQuery/qrcode.js"></script> 
     <script type="text/javascript">     
      $(document).ready(function(){  
       $('#qrcode').qrcode("this plugin is great"); 
      });     
     </script> 
    </head> 
    <body>   
     <div id="qrcode" style="width:100px;height: 100px"></div> 
    </body> 
</html> 

有每個人的想法?

+0

它只是說」對象不支持此方法或屬性「 –

回答

0

有了這個QRCode jquery插件它取決於canvas對象,因爲它不是在IE8中可用,你可能會得到這error object does not support this method or property

當我調試代碼我上線的錯誤

canvas.getContext('2d'); 

所以,這個插件可能無法在IE8

工作
+0

就像第一個答案說的,您只需將渲染設置爲'table',並且它的工作原理IE8! –

3

了jQuery QRCode plugin的網站上有一個examples頁面呈現的QR碼在<table><canvas>。表格選項適用於IE8,您可以使用它來代替畫布以實現完全兼容(或者您可以在檢查瀏覽器類型和版本後編碼切換)。

這裏的示例代碼呈現在<table>代替QR碼:

<script> 
    jQuery('#qrcodeTable').qrcode({ 
     render : "table", 
     text : "http://jetienne.com" 
    }); 
</script> 
0

我已經在Internet Explorer 10的帆布測試,它的工作沒有任何問題......甚至當我選擇「允許被阻止內容「的QR碼也顯示在Internet Explorer 8中。

相關問題