05-12-2013, 04:33 AM | #1 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2009
Location: Adelaide, South Australia
Device: iPhone, iPad, Kobo
|
How can I hide some things from ereaders
This is more complicated than it sounds. I have some components of my ebooks that are there purely for readers using a browser. E.g. navigation at the end of a chapter. In an ePub ereader, or a Kindle, these components are redundant, so I'd like to be able to hide them.
I can use CSS display:none; -- but then I'd need to use a different stylesheet for epub than for the web. So I'm wondering if there's a CSS hack that can be used that would only be seen by a web browser, but be ignored by epub readers. Kind of like the hacks used to make older versions of IE work. Anyone know of any usable hacks? |
05-12-2013, 04:57 AM | #2 |
frumious Bandersnatch
Posts: 7,536
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
You could use alternative stylesheets
With a browser, you should be able to select an alternative one. With an ebook reader you probably won't, so you may need to tweak the order and contents to make sure the right combination is displayed. |
05-12-2013, 05:07 AM | #3 | |
Wizard
Posts: 2,304
Karma: 12587727
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
What is your original book format, HTML? Any specific reason these navigation buttons are essential? Having the toc.ncx + Links should be able to get you wherever you want in the book. If I remember correctly, display:none might not work on some EPUB readers, so the stuff you want hidden might show up anyway. |
|
05-12-2013, 07:36 AM | #4 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
|
05-12-2013, 12:40 PM | #5 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
You could use media queries to test for known devices for Webkit based devices/apps and/or Jellby's XPGT trick to hide styles from ADE/RMSDK based readers, which don't support media queries.
|
05-15-2013, 08:32 AM | #6 | ||
Groupie
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
|
Quote:
Quote:
one (very extravagant) workaround might be to embed a script querying the browser, and load the browser-only css that way. i think there'd be a way for you could target userAgent safari and userAgent chrome to avoid loading your css on webkit-based readers, and you'd end up with a huge conditional statement querying specific vendors, and then defaulting to the standard epub css. http://stackoverflow.com/questions/6...et-only-safari there has to be an easier way though. Last edited by mzmm; 05-15-2013 at 08:45 AM. |
||
05-15-2013, 12:20 PM | #7 |
Resident Curmudgeon
Posts: 76,487
Karma: 136564766
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Why bother to hide the links? They will either work or not.
|
05-20-2013, 03:58 PM | #8 |
Curmudgeon
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Set up your default styles to be appropriate for EPUB readers. Then add JavaScript:
Code:
if (typeOf(navigator.epubReadingSystem) == "undefined") { /* It's a browser. Add a new CSS stylesheet element dynamically. */ } |
Tags |
css, epub, mobi, web |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hide clippings | Me! | Amazon Kindle | 2 | 01-18-2013 08:29 AM |
Is it possible to hide files? | negev | Kindle Developer's Corner | 8 | 12-28-2012 02:41 PM |
Hide Table of Contents? | richard.g | Devices | 3 | 12-06-2011 08:04 AM |
Ereaders WITHOUT These Things | MorganM | Which one should I buy? | 10 | 09-20-2011 02:50 AM |
Hide for Under a Dollar | koland | Deals and Resources (No Self-Promotion or Affiliate Links) | 2 | 06-11-2010 07:14 AM |