Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Safari Support #28

Merged
merged 2 commits into from
Mar 24, 2014
Merged

Better Safari Support #28

merged 2 commits into from
Mar 24, 2014

Conversation

pusherman
Copy link
Contributor

Data isn't served correctly due to a webkit bug that caches some byte range requests. The problem only presents itself when you are viewing the contents of the epub directly by pulling out specific parts of the compressed epub on the fly.

Steps to reproduce:

  1. Clone and install the project from https://github.com/readium/readium-js-viewer
  2. Use grunt to set up the server locally on 8080
  3. In Safari on the Mac or iOS browse to the included example compressed .epub file: http://localhost:8080/simpleviewer.html?epub=epub_content/internal_link.epub

Expected Result:
The red "Cover Page" in the demo epub

Actual Result:
A blank page

Technical Details:
The problem is when zip.js is making the request for a byte range by adding the (example) headers If-Range:"21577-1395235757000", Range:bytes=866-1023 Safari is incorrectly returning the same "range" of bytes no matter what is specified in the headers. Here's a few screenshots from Safari Dev Tools that may explain it more clearly than I am :)

First byte range request made:
first_request

Second byte range request made:
second_request

Notice how Safari also incorrectly reports "No" in the "Cached" column even though the data is clearly being cached which is apparently a bug itself.

This doesn't present itself on unzipped epub content since it makes a full request (not byte range) for each document as it is needed. Thankfully Safari honors the If-None-Match headers-- if added (and does not match the requested files etag) it will serve the correct data for the request and correct the issue.

@bluefirepatrick
Copy link
Member

Cool, glad to see your pull request, thanks for helping out the project.

Patrick

On Thu, Mar 20, 2014 at 12:08 PM, Corey Wilson notifications@github.comwrote:

Steps to reproduce:

  1. Clone and install the project from
    https://github.com/readium/readium-js-viewer
  2. Use grunt to set up the server locally on 8080
  3. In Safari on the Mac or iOS browse to the included example compressed
    .epub file:
    http://localhost:8080/simpleviewer.html?epub=epub_content/internal_link.epub

Expected Result:
The red "Cover Page" in the demo epub

Actual Result:
A blank page

Technical Details:
The problem is when zip.js is making the request for a byte range by
adding the (example) headers If-Range:"21577-1395235757000",
Range:bytes=866-1023 Safari is incorrectly returning the same "range" of
bytes no matter what is specified in the headers. Here's a few screenshots
from Safari Dev Tools that may explain it more clearly than I am :)

First byte range request made:
[image: first_request]https://f.cloud.github.com/assets/382106/2476381/c9045f8a-b062-11e3-8a13-efb81395d764.png

Second byte range request made:
[image: second_request]https://f.cloud.github.com/assets/382106/2476382/cbef6a28-b062-11e3-9855-c73d903e08e0.png

Notice how Safari also incorrectly reports "No" in the "Cached" column
even though the data is clearly being cached which is apparently a bug
itself.

This doesn't present itself on unzipped epub content since it makes a full
request (not byte range) for each document as it is needed. Thankfully
Safari honors the If-None-Match headers-- if added (and does not match the
requested files etag) it will serve the correct data for the request and

correct the issue.

You can merge this Pull Request by running

git pull https://github.com/pusherman/readium-js develop

Or view, comment on, or merge it at:

#28
Commit Summary

  • workaround to prevent caching of byte range requests in zipped
    content in webkit

File Changes

Patch Links:

Reply to this email directly or view it on GitHubhttps://github.com//pull/28
.

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

@pusherman pusherman changed the title Prevent caching of byte range requests in zipped data for Safari and iOS Better Safari Support Mar 20, 2014
@pusherman
Copy link
Contributor Author

Glad I can help! It's an awesome project!

The 2nd commit adds a polyfill for supporting iOS 6

bormind added a commit that referenced this pull request Mar 24, 2014
@bormind bormind merged commit d55521e into readium:develop Mar 24, 2014
@bluefirepatrick
Copy link
Member

Hello,

I have found that the latest develop branches (viewer, readium-js,
shared-js) create a web-based reader that does not play audio for a media
overlay. Unzipped books, and therefore the chrome extension, work fine, it
is just zipped epub.

I can provide more information in the meeting tomorrow, Ric, will you put
this on the agenda?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

@danielweck
Copy link
Member

hello patrick, i cannot even get a zipped epub to open at all. i must be
doing something wrong, what does your epub_content.json look like? thanks,
dan

On Monday, June 16, 2014, Patrick Keating notifications@github.com wrote:

Hello,

I have found that the latest develop branches (viewer, readium-js,
shared-js) create a web-based reader that does not play audio for a media
overlay. Unzipped books, and therefore the chrome extension, work fine, it
is just zipped epub.

I can provide more information in the meeting tomorrow, Ric, will you put
this on the agenda?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).

@bluefirepatrick
Copy link
Member

I can get it to open but the play button does not do anything. Here is the
JSON

{

"title" : "Ladybug Girl",

"author" : "David Soman and Jacky Davis",

"packagePath" : "EPUB/package.opf",

"rootUrl" : "epub_content/ladybug.epub"

}

On Mon, Jun 16, 2014 at 2:53 PM, danielweck notifications@github.com
wrote:

hello patrick, i cannot even get a zipped epub to open at all. i must be
doing something wrong, what does your epub_content.json look like? thanks,
dan

On Monday, June 16, 2014, Patrick Keating notifications@github.com
wrote:

Hello,

I have found that the latest develop branches (viewer, readium-js,
shared-js) create a web-based reader that does not play audio for a
media
overlay. Unzipped books, and therefore the chrome extension, work fine,
it
is just zipped epub.

I can provide more information in the meeting tomorrow, Ric, will you
put
this on the agenda?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

@pusherman
Copy link
Contributor Author

Do you have an example ePub you could send so I could replicate the issue?

If I had to guess it's likely due to limitations of zip.js but I will be happy to look in to it.

On Jun 16, 2014, at 6:59 PM, Patrick Keating notifications@github.com wrote:

I can get it to open but the play button does not do anything. Here is the
JSON

{

"title" : "Ladybug Girl",

"author" : "David Soman and Jacky Davis",

"packagePath" : "EPUB/package.opf",

"rootUrl" : "epub_content/ladybug.epub"

}

On Mon, Jun 16, 2014 at 2:53 PM, danielweck notifications@github.com
wrote:

hello patrick, i cannot even get a zipped epub to open at all. i must be
doing something wrong, what does your epub_content.json look like? thanks,
dan

On Monday, June 16, 2014, Patrick Keating notifications@github.com
wrote:

Hello,

I have found that the latest develop branches (viewer, readium-js,
shared-js) create a web-based reader that does not play audio for a
media
overlay. Unzipped books, and therefore the chrome extension, work fine,
it
is just zipped epub.

I can provide more information in the meeting tomorrow, Ric, will you
put
this on the agenda?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

Reply to this email directly or view it on GitHub.

@danielweck
Copy link
Member

Thanks Patrick, that's what I do too, but the EPUB does not open. I wonder
if it has something to do with:

https://groups.google.com/d/msg/readium-dev/qkoYsF6QvCM/tvc29e3YafUJ

Dan

On Mon, Jun 16, 2014 at 11:59 PM, Patrick Keating notifications@github.com
wrote:

I can get it to open but the play button does not do anything. Here is the
JSON

{

"title" : "Ladybug Girl",

"author" : "David Soman and Jacky Davis",

"packagePath" : "EPUB/package.opf",

"rootUrl" : "epub_content/ladybug.epub"

}

On Mon, Jun 16, 2014 at 2:53 PM, danielweck notifications@github.com
wrote:

hello patrick, i cannot even get a zipped epub to open at all. i must be
doing something wrong, what does your epub_content.json look like?
thanks,
dan

On Monday, June 16, 2014, Patrick Keating notifications@github.com
wrote:

Hello,

I have found that the latest develop branches (viewer, readium-js,
shared-js) create a web-based reader that does not play audio for a
media
overlay. Unzipped books, and therefore the chrome extension, work
fine,
it
is just zipped epub.

I can provide more information in the meeting tomorrow, Ric, will you
put
this on the agenda?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).

@rkwright
Copy link
Member

Will do

Sent with my thumbs

On Jun 16, 2014, at 4:01 PM, Patrick Keating notifications@github.com wrote:

Hello,

I have found that the latest develop branches (viewer, readium-js,
shared-js) create a web-based reader that does not play audio for a media
overlay. Unzipped books, and therefore the chrome extension, work fine, it
is just zipped epub.

I can provide more information in the meeting tomorrow, Ric, will you put
this on the agenda?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

Reply to this email directly or view it on GitHub.

@pusherman
Copy link
Contributor Author

Hey Daniel

I don't believe it has to do with that post. All .epub files I'm trying
with the current develop branch work just fine. If you are opening via the
URL just make sure you have the .epub extension (e.g.
http://localhost:8080/simpleviewer.html?epub=epub_content/ladybugg.epub)

If it still doesn't work you should have some errors in the js console.

-Corey

On Tue, Jun 17, 2014 at 1:40 AM, danielweck notifications@github.com
wrote:

Thanks Patrick, that's what I do too, but the EPUB does not open. I wonder
if it has something to do with:

https://groups.google.com/d/msg/readium-dev/qkoYsF6QvCM/tvc29e3YafUJ

Dan

On Mon, Jun 16, 2014 at 11:59 PM, Patrick Keating <
notifications@github.com>
wrote:

I can get it to open but the play button does not do anything. Here is
the
JSON

{

"title" : "Ladybug Girl",

"author" : "David Soman and Jacky Davis",

"packagePath" : "EPUB/package.opf",

"rootUrl" : "epub_content/ladybug.epub"

}

On Mon, Jun 16, 2014 at 2:53 PM, danielweck notifications@github.com
wrote:

hello patrick, i cannot even get a zipped epub to open at all. i must
be
doing something wrong, what does your epub_content.json look like?
thanks,
dan

On Monday, June 16, 2014, Patrick Keating notifications@github.com
wrote:

Hello,

I have found that the latest develop branches (viewer, readium-js,
shared-js) create a web-based reader that does not play audio for a
media
overlay. Unzipped books, and therefore the chrome extension, work
fine,
it
is just zipped epub.

I can provide more information in the meeting tomorrow, Ric, will
you
put
this on the agenda?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

@bluefirepatrick
Copy link
Member

I'm attempting to load an unpacked chrome extension into Chrome OSX after
running 'grunt chromeApp' and getting an error (see attached) concerning a
missing _locales subtree. Have any of you seen that one before?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

@danielweck
Copy link
Member

are you sure that the unpacked extension path is pointing to the build
folder? (not the chrome-app directory that's one level up)

On Wednesday, June 18, 2014, Patrick Keating notifications@github.com
wrote:

I'm attempting to load an unpacked chrome extension into Chrome OSX after
running 'grunt chromeApp' and getting an error (see attached) concerning a
missing _locales subtree. Have any of you seen that one before?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).

@bluefirepatrick
Copy link
Member

Haha! Yes, I was pointing at the wrong folder!

It seems like a major design flaw that I should have to point my browser at
the correct folder ... ;-)

Thanks, Daniel

On Wed, Jun 18, 2014 at 11:20 AM, danielweck notifications@github.com
wrote:

are you sure that the unpacked extension path is pointing to the build
folder? (not the chrome-app directory that's one level up)

On Wednesday, June 18, 2014, Patrick Keating notifications@github.com
wrote:

I'm attempting to load an unpacked chrome extension into Chrome OSX
after
running 'grunt chromeApp' and getting an error (see attached) concerning
a
missing _locales subtree. Have any of you seen that one before?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

@danielweck
Copy link
Member

tip: "grunt chromeAppDevBuild" to get a different icon and app ID, separate
from official installed release.

On Wednesday, June 18, 2014, Patrick Keating notifications@github.com
wrote:

Haha! Yes, I was pointing at the wrong folder!

It seems like a major design flaw that I should have to point my browser
at
the correct folder ... ;-)

Thanks, Daniel

On Wed, Jun 18, 2014 at 11:20 AM, danielweck <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');>
wrote:

are you sure that the unpacked extension path is pointing to the build
folder? (not the chrome-app directory that's one level up)

On Wednesday, June 18, 2014, Patrick Keating <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');>
wrote:

I'm attempting to load an unpacked chrome extension into Chrome OSX
after
running 'grunt chromeApp' and getting an error (see attached)
concerning
a
missing _locales subtree. Have any of you seen that one before?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).

@bluefirepatrick
Copy link
Member

That is really handy to separate it from the Chrome Web Store version,
thanks.

Patrick

On Wed, Jun 18, 2014 at 11:25 AM, danielweck notifications@github.com
wrote:

tip: "grunt chromeAppDevBuild" to get a different icon and app ID,
separate
from official installed release.

On Wednesday, June 18, 2014, Patrick Keating notifications@github.com
wrote:

Haha! Yes, I was pointing at the wrong folder!

It seems like a major design flaw that I should have to point my browser
at
the correct folder ... ;-)

Thanks, Daniel

On Wed, Jun 18, 2014 at 11:20 AM, danielweck <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');>
wrote:

are you sure that the unpacked extension path is pointing to the build
folder? (not the chrome-app directory that's one level up)

On Wednesday, June 18, 2014, Patrick Keating <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');>
wrote:

I'm attempting to load an unpacked chrome extension into Chrome OSX
after
running 'grunt chromeApp' and getting an error (see attached)
concerning
a
missing _locales subtree. Have any of you seen that one before?

Thanks,

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411


Reply to this email directly or view it on GitHub
#28 (comment).


Reply to this email directly or view it on GitHub
#28 (comment).

Patrick Keating
CTO, Bluefire Productions
Seattle, WA
(206) 781-1411

@aadamowski
Copy link
Member

Hello all,

the discussion seems to have digressed from the original topic (Safari support).

One thing to keep in mind - media overlays currently do not work for zipped EPUBs when read using plain browser-based viewer utilizing the readium-js library - that's a known issue that will require non-trivial changes to be solved (due to inherent limitations of a pure JS, pure client side, browser-based environment).

Taking this into account, does anyone still have problems:

  • on Safari,
  • with reading zipped EPUBs,
  • served through the embedded server launched from the Grunt build, listening on port 8080,
  • while the same zipped EPUBs work fine on Chrome browser, while accessed from the aforementioned server?

@danielweck
Copy link
Member

@aadamowski See new issue here:

#53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants