### Accessing Data Archives with JS9

JS9 can display data in any astronomical archive where a query produces a downloadable URL to a FITS file. The load proxy mechanism is used, so accessing archives assumes that the JS9 web site has been configured to support proxy loads.

### Examples of data archives that generate FITS URLS for use with JS9

- NASA/HEASARC Browse: in the Browse Query Results, the D option ("Preview data products for this row") in the Services column will give FITS URLs.
- NASA/HEASARC SkyView: in the search results, copy the FITS URL from the Download FITS or quick look jpeg image option.
- The Unofficial Chandra Archive: in the search results, drag the Title url onto a JS9 display to retrieve a representation image backed by the event file (for server-side analysis) or click ObsId to get the Chandra HTTP directory for this observation. The *.evt2.fits.gz file contains the raw event data.

### Summary: how to access data archives with JS9

- visit a data archive web page in your browser
- execute a search for the desired observation (e.g., type in 'M87' or 'Crab Nebula' in the Chandra Archive's Name box listed above)
- once the link to a FITS file has been created:
  - drag and drop the FITS link onto your JS9 display
- or:
  - copy the resulting FITS file link
  - in JS9, select the File:open link via proxy ... menu option
  - paste the FITS URL link into the dialog box
  - click the Load button

### Details: using a proxy server to access data archives

For security reasons, JavaScript contained in one web page can access data in another web page only if both web pages have the same origin (i.e., basically coming from the same host). This policy is called the Same Origin Policy. This means that JS9 cannot load a FITS file from an arbitrary URL without using special techniques.

One such technique is to use a proxy server: the URL is not loaded directly into JS9, but instead is copied back to the server from which JS9 itself was loaded. The file is then retrieved by JS9 so that the "same origin" rules are not violated.

When the back-end server associated with a JS9 web page supports the proxy service, you will see a menu option in the File menu called open link via proxy ...

Enter a FITS URL into the proxy dialog box and press the Load button. The data file will be retrieved by the server and stored in a directory specifically tied to the web page. (The directory and its contents will be deleted when the page is unloaded.) JS9 then will load the file from this directory. Note that since the file resides on the back-end server, all back-end analysis defined on that server is available.

You also can drag and drop the link directly onto the JS9 display. The open link via proxy ... menu option is mentioned first, because it can sometimes require less dexterity (e.g., the archive web page is displayed on a different desktop from JS9) and also because it contains a visual cue regarding proxy loads: the option will be greyed out if JS9 has not been configured to allow proxy loads.

This proxy load technique can also be used FITS links from other sources. For example, if you have a FITS file on Google Drive, iCloud, Dropbox or even a static web page, you can generate/copy the link and paste it into the proxy dialog box for display. (Dropbox files also can utilize the open link via CORS ... option, which downloads the data directly to JS9, bypassing the proxy server.)

##### Last updated: August 6, 2021