Skip to content

Commit

Permalink
Trying another way to populate the frame
Browse files Browse the repository at this point in the history
  • Loading branch information
york-stsci committed Nov 27, 2024
1 parent f258e0a commit e037942
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion jwql/website/apps/jwql/templates/explore_image.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h3>{{ file_root }}_{{ filetype }}.fits</h3>
<div class="row">
<!-- Display the image -->
<div class="col-xl-9">
<iframe id="encoder_iframe" height="800px" width="750px" src="https://{{jdaviz_host|safe}}/jdaviz?file={{file_path|safe}}"></iframe>
<iframe id="quickview" height="800px" width="750px" src="/quickview?file={{file_path|safe}}"></iframe>
</div>
</div>

Expand Down Expand Up @@ -64,5 +64,26 @@ <h5>Comments</h5>
</main>
<script>explore_image_update_enable_options('{{ extension_ints }}', '{{ extension_groups }}');</script>
<script>update_explore_image_page('{{inst}}', '{{file_root}}', '{{filetype}}', '{{base_url}}');</script>
<script>
var xhr = new XMLHttpRequest();

xhr.open('GET', 'http://{{jdaviz_host|safe}}:{{jdaviz_port|safe}}?file={{file_path|safe}}');
xhr.onreadystatechange = handler;
xhr.responseType = 'blob';
// xhr.setRequestHeader('X-Script-Name', '/jdaviz');
xhr.send();

function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
// this.response is a Blob, because we set responseType above
var data_url = URL.createObjectURL(this.response);
document.querySelector('#quickview').src = data_url;
} else {
console.error('No quickview :(');
}
}
}
</script>

{% endblock %}

0 comments on commit e037942

Please sign in to comment.