1

I can see the code in Element view in Chrome, but not in source because it is load by document.write function.

How do I set a breakpoint in this case?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Akinohana
  • 35
  • 1
  • 7
  • 1
    there _has_ to be a source for it somewhere, check the network tab an dig through the .js files if needed. – dandavis Jul 25 '17 at 22:42
  • Adding the `debugger` keyword should be enough in the code you are trying to append – Jose Paredes Jul 25 '17 at 22:46
  • 2
    Please do not vandalize your posts. By posting on the Stack Exchange network, you've granted a non-revocable right for SE to distribute that content (under the [CC BY-SA 3.0 license](https://creativecommons.org/licenses/by-sa/3.0/)). By SE policy, any vandalism will be reverted. If you would like to disassociate this post from your account, see [What is the proper route for a disassociation request?](https://meta.stackoverflow.com/q/323395) – Paul Roub Aug 18 '17 at 21:06

1 Answers1

2

I suppose you have access to the source code that generates the document.write, you can add a call to the 'debugger' like this:

<script>
document.write('<sc' + 'ript> debugger; alert(0);</s' + 'cript>');
</script>

I you have the debugger opened on chrome, it will stop the execution and show the generated code on the Sources tab.

Gustavo Jantsch
  • 382
  • 2
  • 9