Load scripts synchronously

External scripts were being asynchronously loaded as part of the new page being loaded. This could break inlined scripts that depended on such scripts.

Example:
```
<script src="http://example.com/external_methods.js"></script>
<script>external_method();</script>
```

This pull request fixes this problem by waiting for scripts to load before inserting the remaining `script` elements.