{"action":"created","issue":{"url":"https://api.github.com/repos/openseadragon/openseadragon/issues/1055","repository_url":"https://api.github.com/repos/openseadragon/openseadragon","labels_url":"https://api.github.com/repos/openseadragon/openseadragon/issues/1055/labels{/name}","comments_url":"https://api.github.com/repos/openseadragon/openseadragon/issues/1055/comments","events_url":"https://api.github.com/repos/openseadragon/openseadragon/issues/1055/events","html_url":"https://github.com/openseadragon/openseadragon/pull/1055","id":184580421,"number":1055,"title":"Add options for loading tiles via AJAX and custom AJAX request headers. (resolves #1032)","user":{"login":"seanich","id":2020848,"avatar_url":"https://avatars.githubusercontent.com/u/2020848?v=3","gravatar_id":"","url":"https://api.github.com/users/seanich","html_url":"https://github.com/seanich","followers_url":"https://api.github.com/users/seanich/followers","following_url":"https://api.github.com/users/seanich/following{/other_user}","gists_url":"https://api.github.com/users/seanich/gists{/gist_id}","starred_url":"https://api.github.com/users/seanich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanich/subscriptions","organizations_url":"https://api.github.com/users/seanich/orgs","repos_url":"https://api.github.com/users/seanich/repos","events_url":"https://api.github.com/users/seanich/events{/privacy}","received_events_url":"https://api.github.com/users/seanich/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-21T22:05:43Z","updated_at":"2016-11-10T18:27:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openseadragon/openseadragon/pulls/1055","html_url":"https://github.com/openseadragon/openseadragon/pull/1055","diff_url":"https://github.com/openseadragon/openseadragon/pull/1055.diff","patch_url":"https://github.com/openseadragon/openseadragon/pull/1055.patch"},"body":"**This is a draft to get some feedback about the changes. I would still like to add some unit tests and look over the documentation again to make sure it is properly updated.**\n\nThis PR adds several options to allow for tiles to be loaded via AJAX requests with custom headers. You can see the new features in action in `test/demo/customheaders.html`.\n## New options\n#### `loadTilesWithAjax` (Boolean)\n\nThis option can be set on the `Viewer` and can overridden per image in the options of `Viewer.addTiledImage`. When set to `true` all the image data for tiles in the Viewer/TiledImage will be loaded with AJAX requests.\n#### `ajaxRequestHeaders` (String -> String mapping)\n\nThis option can be set on the `Viewer` and additional headers can be added per image in the options of `Viewer.addTiledImage`. \n\nThe headers set on the `Viewer` will be applied to all AJAX requests (including those from `TileSource`s). The headers specified `Viewer.addTiledImage` will be merged with the headers set in `Viewer` (if any) and applied to all tile AJAX requests.\n\nThis feature is very useful when using token-based authentication.\n## New methods\n#### `TileSource.getTileHeaders(level, x, y)` (returns String -> String mapping)\n\nThis method allows unique headers to be set on each tile in the image (similar to `TileSource.getTileUrl`). The headers will be merged with those set in the `Viewer` options and the `TiledImage` options.\n\nThis could be useful if your tiles are contained in a single file and you want to retrieve them using byte ranges via the `Range` header. See [here](https://github.com/openseadragon/openseadragon/issues/1032#issuecomment-248323573) for an example.\n## Event changes\n#### `tile-load-failed`\n\nThe `tile-load-failed` event now includes the `tileRequest` property which will contain the `XMLHTTPRequest` used to load the tile (if available). This is useful for error handling based on the status code and response data.\n## Other changes\n#### `OpenSeadragon.makeAjaxRequest`\n\nThis method now accepts a `headers` option.\n## Potential issues\n- Setting the `loadTilesWithAjax` option will limit browser support to IE 10+ due to the use of [`responseType = 'arraybuffer'`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Browser_compatibility) and [createObjectURL](http://caniuse.com/#feat=bloburls).\n- AJAX requests may not work with `file://` URLs.\n\nThis ended up being a pretty large change so please let me know if you have any questions, concerns, or suggestions. :)\n"},"comment":{"url":"https://api.github.com/repos/openseadragon/openseadragon/issues/comments/259768007","html_url":"https://github.com/openseadragon/openseadragon/pull/1055#issuecomment-259768007","issue_url":"https://api.github.com/repos/openseadragon/openseadragon/issues/1055","id":259768007,"user":{"login":"adgoncal","id":10856791,"avatar_url":"https://avatars.githubusercontent.com/u/10856791?v=3","gravatar_id":"","url":"https://api.github.com/users/adgoncal","html_url":"https://github.com/adgoncal","followers_url":"https://api.github.com/users/adgoncal/followers","following_url":"https://api.github.com/users/adgoncal/following{/other_user}","gists_url":"https://api.github.com/users/adgoncal/gists{/gist_id}","starred_url":"https://api.github.com/users/adgoncal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adgoncal/subscriptions","organizations_url":"https://api.github.com/users/adgoncal/orgs","repos_url":"https://api.github.com/users/adgoncal/repos","events_url":"https://api.github.com/users/adgoncal/events{/privacy}","received_events_url":"https://api.github.com/users/adgoncal/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T18:27:17Z","updated_at":"2016-11-10T18:27:17Z","body":"This is really cool!\r\nAny change of adding the option for progress information on the request?\r\nIt would be nice to show a progress bar in certain circumstances."}}
{"actor":{"display_login":"adgoncal"}}