Commit 6a5e3369 authored by Sean Hammond's avatar Sean Hammond

Merge pull request #3258 from hypothesis/live-reload-server-host

Make client test page load embed from same hostname as test page
parents 70b81486 1dbbd4a9
...@@ -38,9 +38,11 @@ function LiveReloadServer(port, appServer) { ...@@ -38,9 +38,11 @@ function LiveReloadServer(port, appServer) {
<body> <body>
<pre style="margin: 75px;">${changelogText()}</pre> <pre style="margin: 75px;">${changelogText()}</pre>
<script> <script>
var appHost = document.location.hostname;
window.hypothesisConfig = function () { window.hypothesisConfig = function () {
return { return {
liveReloadServer: 'ws://localhost:${port}', liveReloadServer: 'ws://' + appHost + ':${port}',
// Open the sidebar when the page loads // Open the sidebar when the page loads
firstRun: true, firstRun: true,
...@@ -52,8 +54,11 @@ function LiveReloadServer(port, appServer) { ...@@ -52,8 +54,11 @@ function LiveReloadServer(port, appServer) {
window.location.reload(); window.location.reload();
} }
}); });
var embedScript = document.createElement('script');
embedScript.src = '${appServer}/embed.js'.replace('localhost', appHost);
document.body.appendChild(embedScript);
</script> </script>
<script src="${appServer}/embed.js"></script>
</body> </body>
</html> </html>
`; `;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment