Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-12-2013, 03: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, 03: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: 5,971
Karma: 4346919
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
 
Enthusiast
Old 05-12-2013, 04:07 AM   #3
Tex2002ans
Evangelist
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: 429
Karma: 360129
Join Date: Jul 2012
Device: 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, 06:36 AM   #4
mrmikel
Book Twiddler
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: 1,918
Karma: 1405001
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, 11:40 AM   #5
Doitsu
Wizard
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: 1,857
Karma: 4630359
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, 07: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: 156
Karma: 86115
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 07:45 AM.
mzmm is offline   Reply With Quote
Old 05-15-2013, 11:20 AM   #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: 36,133
Karma: 17161828
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Why bother to hide the links? They will either work or not.
JSWolf is online now   Reply With Quote
Old 05-20-2013, 02: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.
 
Posts: 248
Karma: 556004
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide clippings Me! Amazon Kindle 2 01-18-2013 07:29 AM
Is it possible to hide files? negev Kindle Developer's Corner 8 12-28-2012 01:41 PM
Hide Table of Contents? richard.g Devices 3 12-06-2011 07:04 AM
Ereaders WITHOUT These Things MorganM Which one should I buy? 10 09-20-2011 01:50 AM
Hide for Under a Dollar koland Deals, Freebies, and Resources (No Self-Promotion) 2 06-11-2010 06:14 AM


All times are GMT -4. The time now is 09:28 AM.


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