javascript - How do I get the path of the currently running script? -


we have ie extension implemented browser helper object (bho). have utility function written in c++ add window object of page other scripts in page can use load local script files dynamically. in order resolve relative paths these local script files, however, need determine path of javascript file calls our function:

  • myfunc() written in c++ , exposed page's javascript
  • file:///path/to/some/javascript.js
  • (additional stack frames)

from top frame want information script calling myfunc() located in file:///path/to/some/javascript.js.

i first expected use iactivescriptdebug interface stacktrace our utility function. however, appears impossible iactivescript interface iwebbrowser2 interface or associated document (see full callstack multiple frames js on ie8).

the thing can think of register our own script debugger implementation , have myfunc() break debugger. however, i'm skeptical work without prompting user whether want break debugger.

before doing more thorough tests of approach, wanted check whether has definitive information whether work and/or can suggest alternative approach enable function written in c++ stack trace scripting engine invoked it.

each script load may have id , each method of script calling myfunc() may pass id myfunc(). means first have modify myfunct() , alter scripts , calls.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -