FolioReader / FolioReader-Android

A Java ePub reader and parser framework for Android.
BSD 3-Clause "New" or "Revised" License
2.25k stars 718 forks source link

How to add JavaScript into epub #144

Open Ijaycool opened 6 years ago

Ijaycool commented 6 years ago

Am sorry if this isn't the right place to ask for help. Am joining today. I had my ebook as HTML file (within a webview app) with a tagger script in the head tag of my HTML file. The script automatically adds link tags to famous names, these links shows a dialogue box onclick, with a brief bio of the famous person. Is there anyway I can put that JavaScript in this reader so it is injected into the ebook when they are opened in the FolioReader app? Thanks

Ijaycool commented 6 years ago

No help?

mahavir155 commented 6 years ago

@Ijaycool i don't think, there is anyway to inject your own javascript into the reader.. but if you add the script in epub html, i think, it should call javascript function to display dialog box..

Ijaycool commented 6 years ago

@mahavir155 thanks for responding. Let me clear, if there is js in my HTML (zipped as epub) FolioReader will call the js function? If that is correct, then that's amazing.

mahavir155 commented 6 years ago

@Ijaycool Yes, i think it should call.. we don't remove existing JS functions.. we just inject some JS.. Can you please try if you have just epub and let us know if it work?

Ijaycool commented 6 years ago

@mahavir155 thanks. I tried, FolioReader ignored my js. Can't I hardcode the js into the reader? Since it's the single ebook I wish to access. Thanks