I'm trying to run simple script using stack snippets:
IF EXISTS(SELECT id from test) UPDATE test SET *test.name (SELECT memberform.name FROM Tamio.dbo.memberform)*; ELSE INSERT INTO test(id,name) SELECT id,name FROM Tamio.dbo.memberform;
var img = document.getElementsByTagName('img')[0];
Tesseract.recognize(img, function(err, result) {
console.log(result);
});
But got error: <script src="http://tenso.rs/tesseract.js" crossorigin="anonymous"></script>
<img src="https://www.w3.org/TR/SVGTiny12/examples/textArea01.png"/>
, why? when I open http://tenso.rs/tesseract.js it redirect to https://cdn.rawgit.com/naptha/tesseract.js/master/lib/Tesseract.2015.07.26.js and there is the code, but when I include that file instead I got unknown error Uncaught ReferenceError: Tesseract is not defined
because of cross origin. How to resolve this?
答案 0 :(得分:-1)
这里工作得很好:Working example
https://cdn.rawgit.com/naptha/tesseract.js/master/lib/Tesseract.2015.07.26.js
只需使用cdn url,这样你就不会得到一个crossbrowser异常。 (通过https服务器的http请求,例如jsfiddle)。
编辑:您还调用了尚未定义的函数(在加载定义它的脚本之前调用该函数)。 您可以修复此问题,将脚本放在代码的末尾。
var img = document.getElementsByTagName('img')[0];
Tesseract.recognize(img, function(err, result) {
console.log(result);
});