| 
			
			 | 
		#1 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 9 
				Karma: 10 
				Join Date: Feb 2023 
				
				
				
				Device: kobo h2o 
				
				
				 | 
	
	
	
		
		
			
			 
			
			Hello 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I am trying to develo a stupid epub, but a problem arised I cannot solve. May be someone faced it. I composed an epub3 using Sigil, with a single HTML page, like this : <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <head> <title></title> <script type="text/javascript"> function myFun(k) { this.item = k; } </script> </head> <body> <div id="number_one"> <script type="text/javascript"> const c = new myFun("test"); document.getElementById("number_one").innerHTML = c.item; </script> </div> </body> </html> it works fine on any reader I checked, and also on Kobo devices (Aura and Libra). If I try to use an external file for the function, like this: xml version="1.0" encoding="utf-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <head> <title></title> <script type="text/javascript" src="../Misc/Script0001.js"></script> </head> <body> <div id="number_one"> <script type="text/javascript"> const c = new myFun(" test 01 : from external file"); document.getElementById("number_one").innerHTML = c.item; </script> </div> </body> </html> and script Script0001.js : function myFun(k) { this.item = k; } it works on Thorium, on Adobe Digital, on Sigil previewer but DON'T work on Kobo. Of course I checked opf, mimetype, etc, etc. I never got errors, epub checkers say it's fine, but no way. Could someone help me? Thanks a lot  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Bibliophagist 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 48,175 
				Karma: 174315444 
				Join Date: Jul 2010 
				Location: Vancouver 
				
				
				Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			The question that comes to mind is if you sent it to your Kobo as a .kepub.epub to trigger the WebKit based renderer. If you send it as an epub, you will use the Adobe RMSDK renderer which is more limited on what it will accept.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 9 
				Karma: 10 
				Join Date: Feb 2023 
				
				
				
				Device: kobo h2o 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks for your answer. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I forgot to state that I made both the tryes. I used 3 or 4 different tools to translate in kepub (calibre, kepubify, etc.), and the result was always the same of epub: no way!  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | |
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 983 
				Karma: 2209358 
				Join Date: Nov 2011 
				Location: London, UK 
				
				
				Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Shouldn't your second test use: 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Quote: 
	
 Is Script0001.js in the manifest? If you're using Sigil I'd expect it to keeping that up-to-date.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 9 
				Karma: 10 
				Join Date: Feb 2023 
				
				
				
				Device: kobo h2o 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Yes, the file is in the manifest. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I didn’t understand where I should use that script row, sorry.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 9 
				Karma: 10 
				Join Date: Feb 2023 
				
				
				
				Device: kobo h2o 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi Chrisridd 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I finally got what you said, and I made a try, but the result didn't change. Thank you for the correction.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 983 
				Karma: 2209358 
				Join Date: Nov 2011 
				Location: London, UK 
				
				
				Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Kobo's a bit ambiguous about their Javascript support on e-ink. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Here it says there's limited support: https://github.com/kobolabs/epub-spe...script-support But here it says it isn't supported at all: https://github.com/kobolabs/epub-spec#support-grid  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 9 
				Karma: 10 
				Join Date: Feb 2023 
				
				
				
				Device: kobo h2o 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Yes, I read that document. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	As you can see from my little test, it seems than javascript is supported and working, but it is not if functions are in external files. I can't undenrstand, external files for fonts and styles are read correctly, so external files js should be read as well...  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | |
| 
			
			
			
			 Still reading 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,004 
				Karma: 111111255 
				Join Date: Jun 2017 
				Location: Ireland 
				
				
				Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Really only non-ereader apps should execute programs.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 9 
				Karma: 10 
				Join Date: Feb 2023 
				
				
				
				Device: kobo h2o 
				
				
				 | 
	
	
	
		
		
			
			 
			
			If someone is interested, I found a way for executing javascript from extern files. 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Don't ask me why or what, but I saw that if the epub contains MINIFIED js files, it works correctly on Kobo Aura, Kobo Touch and Kobo Libra. I made some test on the same epub I posted at the beginning, and on some other file, and the result is OK: if js file is minified it works on Kobo. Last edited by laverdure; 07-17-2023 at 11:17 AM. Reason: Missing info  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 983 
				Karma: 2209358 
				Join Date: Nov 2011 
				Location: London, UK 
				
				
				Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
| Tags | 
| epub3, javascript, kobo | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| EPUB3: resize SVG in javascript | fbrzvnrnd | ePub | 32 | 02-03-2017 05:39 AM | 
| ePub3: localStorage/JavaScript/RTL support | Doitsu | ePub | 7 | 06-02-2015 07:55 AM | 
| Is there any android epub reader supporting epub3 with audio/video/javascript? | happycoding | Android Developer's Corner | 10 | 07-29-2014 12:16 PM | 
| Create a javascript quizz for Epub3 in Sigil | BertrandThibaut | Sigil | 3 | 01-26-2014 10:04 AM | 
| JAVASCRIPT support in ePub2/ePub3 | Raja1205 | ePub | 7 | 09-03-2012 07:48 AM |