Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-12-2013, 04:33 AM   #1
spotrick
Junior Member
spotrick began at the beginning.
 
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?
spotrick is offline   Reply With Quote
Old 05-12-2013, 04:57 AM   #2
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
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.
Jellby is offline   Reply With Quote
Old 05-12-2013, 05:07 AM   #3
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,304
Karma: 12587727
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by spotrick View Post
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.
There is potentially something that can be done with media queries (although I am no expert in those). Perhaps if you post some sample images/code, others on the forum can give more recommendations.

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.

Quote:
Originally Posted by spotrick View Post
I can use CSS display:none; -- but then I'd need to use a different stylesheet for epub than for the web.
If I remember correctly, display:none might not work on some EPUB readers, so the stuff you want hidden might show up anyway.
Tex2002ans is offline   Reply With Quote
Old 05-12-2013, 07:36 AM   #4
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
Quote:
Originally Posted by Tex2002ans View Post
If I remember correctly, display:none might not work on some EPUB readers, so the stuff you want hidden might show up anyway.
Or it shows up as empty space in the middle of a line!
mrmikel is offline   Reply With Quote
Old 05-12-2013, 12:40 PM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by spotrick View Post
Anyone know of any usable hacks?
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.
Doitsu is offline   Reply With Quote
Old 05-15-2013, 08:32 AM   #6
mzmm
Groupie
mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.
 
mzmm's Avatar
 
Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
Quote:
Originally Posted by Doitsu View Post
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.
although if you were reading the ebook in a browser on a smartphone/tablet it would still hide the content.

Quote:
Originally Posted by spotrick View Post
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?
are the epub's ncx or opf functional in the browser version (in an epub reading engine), or are you just displaying the book's html in the browser?

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.
mzmm is offline   Reply With Quote
Old 05-15-2013, 12:20 PM   #7
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
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.
JSWolf is offline   Reply With Quote
Old 05-20-2013, 03:58 PM   #8
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
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. */
}
Readers that support only EPUB 2 won't load the JavaScript. Readers that support EPUB 3 and JavaScript will have an appropriate object there. So if you get into the body of that if statement, the content is being shown by a web browser.
dgatwood is offline   Reply With Quote
Reply

Tags
css, epub, mobi, web


Forum Jump

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


All times are GMT -4. The time now is 04:28 PM.


MobileRead.com is a privately owned, operated and funded community.