Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9082469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:33:55+00:00 2026-06-16T20:33:55+00:00

I am currently working on an interactive HTML5 widget for an EPUB file. We

  • 0

I am currently working on an interactive HTML5 widget for an EPUB file. We typically use jQuery to do these things.

Current project would be much easier if I could include an XML data file in with the EPUB manifest and then have my little HTML5 widget read in the data from the XML file using standard jQuery and AJAX methods.

I have done this a thousand times for web applications just having difficulty doing it inside of an EPUB file.

My main questions are:

1) Is this even possible?

2) What is the proper media-type to use when declaring the data XML file in the package.opf?

I am using the following code:

$.ajax({
    type: "GET",
    async: false,
    cache: false,
    url: "data/test.xml",
    dataType: "xml",
    error: function() {
        alert("ERROR: The table data could not be read...");
    },
    success: function(objFileContents) {
        alert("SUCCESS");
    }
);

The error alert keeps displaying when I test in iBooks. But, everything works fine when I test in Safari on my desktop.

Any assistance is greatly appreciated.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:33:56+00:00Added an answer on June 16, 2026 at 8:33 pm

    One has to wonder what the point of using a huge library like jQuery is inside an EPUB, when one of the main purposes of jQuery is cross-browser compatibility. I’d strongly recommend using standard ECMA5/XHTML5 techniques.

    Anyway, of course you can include an XML file in an EPUB and read it. What difficulties are you having? The obvious thing is to check the path. Are you sure it should not be ../data/text.xml, for instance? For media type, all else being equal, just use text/xml or application/xml.

    Please note that some readers may return a value of 0, for unknown reasons, even when the read was successful. That may be tricking jQuery into reporting an error. But you should be able to access the responseText or responseXml field of the underlying XMLHttpRequest object.

    I use the following code and it works just fine:

    read=(function(){
        var r=new XMLHttpRequest();
        return function(src){
            r.open('GET', src, false);
            r.send();
            if(r.status!=200 && r.status!=0){//E-books return 0 for some reason?
                //REPORT ERROR
                return null;
            }
            return r.responseText;
        };
    }())
    ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am working on an interactive HTML5 video player, and currently have everything
in F# interactive:how to display/change current working directory?
Currently working for the first time with JSON and with little experience of jQuery.
I'm currently working on a small script that needs to use gtk.StatusIcon() . For
I am currently working on a large project, and I spend most of the
I am currently working on a project where i need to have an in
I'm working on an interactive web application, currently set up on http://picselbocs.com/projects/goalcandy (user: demo@demo.com,
I'm working on an interactive web application, currently set up on http://picselbocs.com/projects/goalcandy (user: demo@demo.com,
I'm working on an interactive web application, currently set up on http://picselbocs.com/projects/goalcandy (user: demo@demo.com,
I'm currently working on a holiday project aimed at simulating biological body clocks. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.