C
C
coderprowin2017-03-24 01:17:42
JavaScript
coderprowin, 2017-03-24 01:17:42

How to solve js script execution error in delphi?

The problem in general is this.
There are js functions

function myAwesomeStealedFunction() {
  var e=function(){return document.domain?function(e,t){t||(t=e);var n=e.split(t[2]),r="";for(var i=n.length-1;i>=0;i--)r=r+n[i]+t[i%t.length];return r}(function(e){if(typeof location!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("44cd9d1d743232bec9c1f1d2643733be"),function(e){if(typeof location!="undefined"&&typeof location.host!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("d06a6a4a55bd50c554e38c184aede1ae")):""}();return e=function(){return document.documentElement?function(e,t){t||(t=e);var n=e.split(t[2]),r="";for(var i=n.length-1;i>=0;i--)r=r+n[i]+t[i%t.length];return r}(e,function(e){if(typeof location!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("9fa1769224069d6f85df8f840b102105")):""}(),e=function(){return document.documentElement?e+function(e,t){t||(t=e);var n=e.split(t[2]),r="";for(var i=n.length-1;i>=0;i--)r=r+n[i]+t[i%t.length];return r}(function(e){if(typeof screen!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("01b35fa43b635e90f0a65b6fc4da6d09"),function(e){if(typeof navigator!="undefined"&&typeof navigator.appName!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("b6c3e9fe349bc1d4b4a0717c5c6580d0")):""}(),e=function(){return document.styleSheets?e+function(e,t){var n=t&&t.charCodeAt(0)%26||e.charCodeAt(3)%26,r=-1,i=e.replace(/[a-zA-Z]/g,function(e){return r+=1,String.fromCharCode((e<="Z"?90:122)>=(e=(e.charCodeAt(0)+t.charCodeAt(r%t.length))%26+n+(e<="Z"?90:122)-26)?e:e-26)});return i}(function(e){if(typeof screen!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("cc061df6226b138a339aa7dfbf43f0ba"),function(e){if(typeof navigator!="undefined"&&typeof navigator.appName!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("d9bb30e8e560c9180a41ddfc96cf12bd")):""}(),e=function(){return document.characterSet?function(e,t){var n=-1,r=e.replace(/[a-zA-Z]/g,function(e){return n+=1,String.fromCharCode((e<="Z"?90:122)>=(e=(e.charCodeAt(0)+t.charCodeAt(n%t.length))%26+13+(e<="Z"?90:122)-26)?e:e-26)});return r}(e,function(e){if(typeof location!="undefined"&&typeof location.host!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("9f939d8e0a555d764cb5c7e8ff53fdb3")):""}(),e=function(){return document.documentElement?function(e,t){var n=-1,r=e.replace(/[a-zA-Z]/g,function(e){return n+=1,String.fromCharCode((e<="Z"?90:122)>=(e=(e.charCodeAt(0)+t.charCodeAt(n%t.length))%26+13+(e<="Z"?90:122)-26)?e:e-26)});return r}(e,function(e){if(typeof screen!="undefined"){var t=e.charCodeAt(0)%e.length,n=e.substring(t)+e.substring(0,t);return n}return b}("e2fad677976e57127d82363cb9eef5bc")):""}(),e+=function(e,t){return typeof navigator!="undefined"&&typeof navigator.appName!="undefined"?t:e}("a63534b39fa4a786","c44baadbecf07e54"),e
}

myAwesomeStealedFunction()

Everything works fine in the browser console.
As soon as I throw a function into the memo and try to execute it through MSScriptControl , an error comes up:
"document" - the definition is missing.
How to solve this problem, and how to determine it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kulik, 2017-03-24
@lnkvisitor

There is no document in the client environment. It is only available in browsers, like window.
Do another check on this['document']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question