1

I recently got an inexpensive phone with minimal browser support i.e. no javascript and on a small screen. Wanting to make the most of my device, I decided I would load some ebooks onto my device through a workaround.

I saved a page for offline viewing and then connected it to my computer to explore the file-system. I found where the offline page was being stored and opened it to see that it was an ordinary HTML file except it had a binary header. Essentially what I want to do is replace the content of the page with an HTML version of the ebook. But when I modify anything in the body section of the file, it doesn't work which leads me to believe that a hash signature is stored in the header but that is just speculation.

Here is an example of a saved file. The binary characters don't display on SO so see bellow for the Hex:

Chttp://example.com/Example Domain<!doctype html>
<html>
<head>
    <title>Example Domain</title>

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
    body {
        background-color: #f0f0f2;
        margin: 0;
        padding: 0;
        font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

    }
    div {
        width: 600px;
        margin: 5em auto;
        padding: 50px;
        background-color: #fff;
        border-radius: 1em;
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        body {
            background-color: #fff;
        }
        div {
            width: auto;
            margin: 0 auto;
            border-radius: 0;
            padding: 1em;
        }
    }
    </style>    
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is established to be used for illustrative examples in documents. You may use this
    domain in examples without prior coordination or asking for permission.</p>
    <p><a href="http://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

The hex of everything until the end of <!doctype html>:

43 00 00 00 01 00 00 00 00 00 00 00 13 00 00 00 1C 00 00 00 68 74 74 70 3A 2F 2F 65 78 61 6D 70 6C 65 2E 63 6F 6D 2F 45 00 78 00 61 00 6D 00 70 00 6C 00 65 00 20 00 44 00 6F 00 6D 00 61 00 69 00 6E 00 3C 21 64 6F 63 74 79 70 65 20 68 74 6D 6C 3E

The only thing I could glean from the header is that the first Dword refers to the offset of the start of the document i.e. the first character of <!doctype html>.

What does the rest of the header mean and how should I modify it?

closed as off-topic by gnat, Sebastian Redl, Bart van Ingen Schenau, Jörg W Mittag, Arseni Mourzenko Sep 12 '16 at 10:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking for assistance in writing or debugging existing code are off-topic on Programmers. These questions can be asked on Stack Overflow if they include the desired behavior, a specific problem or error, and the shortest code necessary to reproduce it in the question itself. See How To Create a Minimal, Complete, and Verifiable Example." – gnat, Arseni Mourzenko
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    I'm voting to close this question as off-topic because it asks about the behavior of some program (Internet Explorer or Edge?), not about programming. – Sebastian Redl Sep 12 '16 at 9:32
  • Fair enough @SebastianRedl Where do you suggest I ask the question? – Lord Ratte Sep 12 '16 at 9:54
  • As an afterthought: it is a coding language even if it isn't a programming language. – Lord Ratte Sep 12 '16 at 10:02
  • 2
    We can't tell you how the proprietary binary format that your phone uses to store offline web pages works, especially since we don't even know what kind of phone it is. This is a question for your phone's manual or your phone's vendor's customer support. – Jörg W Mittag Sep 12 '16 at 10:04
  • 1
    I'm voting to close this question as off-topic because it is about reverse engineering a file format, not a conceptual question about software engineering. – Jörg W Mittag Sep 12 '16 at 10:05

Browse other questions tagged or ask your own question.