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 8761199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:13:49+00:00 2026-06-13T15:13:49+00:00

I need to display large-ish text files (under 10 MB) on mobile device browsers.

  • 0

I need to display large-ish text files (under 10 MB) on mobile device browsers. Downloading the file in chunks isn’t currently supported.

What I currently do right now is the following:

  1. Download file
  2. Put file contents into a <pre> tag

The problem with this is that the <pre> doesn’t do word-wrapping well with the word-wrap:break-words CSS. It breaks words (obviously) in unacceptable ways and makes the displayed text unreadable. No word-wrapping isn’t an option, because you don’t want horizontal scrolling (and mobile Safari simply refuses to spawn horizontal scrollbars on <pre> elements)

Transforming the plain text into equivalent HTML and then inserting said HTML into the DOM takes forever (the insertion is the bottleneck here; conversion time is on the order of milliseconds).

Any ideas as to how to display plain text in an acceptable fashion on a mobile device?

Edit:

Removed the part about using web workers because it can’t do DOM manipulation and at the time, I thought text processing was the bottleneck

  • 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-13T15:13:51+00:00Added an answer on June 13, 2026 at 3:13 pm

    The way I did it was as follows:

    <pre id='text_preview'>
    </pre>
    

    Approximate code below.

    $.get("url/of/text/file.txt", function(response) {
        var fileText = response, pageNumber = 1, pageSize = 105600;
        //first 100 kb of content, assuming 8 bytes/char
        //don't have exact value for this, using approx
        $('#text_preview').text(fileText.slice(0, pageNumber * pageSize);
        window.onscroll = function() {
           //implementation of this left as an exercise for the reader
           if(scrollNearBottom()) {
              pageNumber++;
              $("#text_preview").append(fileText.slice((pageNumber - 1) * pageSize, pageNumber * pageSize);
           }
        }
    });
    

    Obviously, this won’t help my need to find text using Ctrl+F but does satisfy the requirement that I be able to display large e-books.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large comma-seperated text-file. I need to display this in a
I need to display some very large images on the iPad. The files are
I need to constantly display large amounts of colored text in WPF or Silverlight,
I need to display in scrollable TextView really large amount of text (up to
I need to display a large amount of data (around 50-60K rows). I was
I have a large database table that I need to display on a Windows
I need to display a large number (500+) of small circles on a form
Problem We need to efficiently display a large (>1000) number of objects in a
I am working on an Iphone application and I need to display a large
I'm creating an application where I need to model (and display) a large number

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.