Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 04-27-2015, 03:18 PM   #1
BenTrafford
Junior Member
BenTrafford began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2006
Location: Waterloo, Ontario, Canada
Loading external file via Ajax.

Hi!

I'm trying to load an external file into my ebook via an Ajax call. The file is local to the EPUB document. However, it's not working -- does Calibre support this?

Here's the code I'm using:

Code:
$.ajax({
	async: false,
	url: theExternalDocument,
	dataType: 'xml',
	success: function(data) {
		var xmlData = new XMLSerializer();
		var strungData = xmlData.serializeToString(data);
		var fixedData = strungData.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/g, '');
		documents[b] = new Array();
		documents[b]['contents'] = $("body", $("<div>" + fixedData + "</div>")).html();
		documents[b]['url'] = uniqueReferences[index];
	}
});
It's working in iBooks, Readium, etc., but pretty much dies in Calibre.
BenTrafford is offline   Reply With Quote
Old 04-27-2015, 10:50 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre uses WebKit, so ajaz should work fine. "Pretty much dies" is not very illuminating. Use the Console or run the viewer in debug mode

calibre-debug -w
kovidgoyal is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SVG images, external file versus inline j.p.s ePub 4 07-18-2014 11:30 AM
Loading a png file dragon123 Kindle Developer's Corner 1 12-06-2013 12:22 PM
External viewer opens temp file Aiwass Library Management 4 04-29-2013 04:44 AM
External CSS file questions michaelbr Sigil 10 01-27-2011 08:08 AM
Large sony file not loading markiehill Sony Reader 3 10-10-2008 12:10 PM


All times are GMT -4. The time now is 06:44 PM.


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