javascript - Accessing webpage script from content script -


I try to execute an onclick () event of a code ( & lt) I am doing; A & gt; ), but it does not take the visitor anywhere, it executes the javascript code, however, how can I execute the code, due to that content script, the scripts on that webpage can not be accessed Let's go The code that should be executed uses custom functions, which are declared in the webpage.

Jquery):

Understand that 'myfunc' in the script-in-page The function that you want to be able to perform.

var script = $ ("#webscript"); (or any other way of getting a script tag that contains the code)

  var myfunc = null; // Function-name declare (probably not even necessary) eval (script.html ()); // where myfunc has been announced and your myfunc variable has been specified   

Try using the function now:

  myfunc ( );   

Edit 2: You may also:

  var copyScript = document.createElement ('script' ); CopyScript.type = 'text / javascript'; CopyScript.text = script.html (); Document.head.appendChild (copyScript);    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -