PhantomJS is effectively a browser. You cannot edit a webpage in a browser before the browser has loaded it.
Don't bother trying to disable JavaScript in PhatomJS either because then you won't be able to use JavaScript to inject the JavaScript you need before enabling JavaScript.
<script>block before the other<script>blocks on the page