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

  • Home
  • SEARCH
  • 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 6746353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:18:45+00:00 2026-05-26T12:18:45+00:00

I compose a large HTML file out of a huge unformatted text file. Now

  • 0

I compose a large HTML file out of a huge unformatted text file. Now my fear is that the text file might contain some malicious javascript code. To avoid any damage I scan the text and replace any < or > with lt and gt. That is quite effective, but it’s not really good for the performance.

Is there some tag or attribute or whatever that allows me to turn javascript off within the HTML file? In the header perhaps?

  • 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-05-26T12:18:45+00:00Added an answer on May 26, 2026 at 12:18 pm

    Since you’ve considered replacing all < and > by the HTML entities, a good option would consist of sending the Content-Type: text/plain header.

    If you include want to show the contents of the file, replacing every & by &amp; and every < by &lt; is sufficient to correctly display the contents of the file. Example:

    Input: Huge wall of text 1<a2 &>1

    Output: Huge wall of text 1&lt;a2 &amp;>1

    Unmodified output, displaying in browser: Huge wall of text 11 (<..> interpreted as HTML)

    If you cannot modify code at the back-end (server-side), you need a HTML parser, which sanitised your code. JavaScript is not the only threat, embedded content (<object>, <iframe>, …) can also be very malicious. Have a look at the following answer for a very detailed HTML parser & sanitizer :
    Can I load an entire HTML document into a document fragment in Internet Explorer?

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

Sidebar

Related Questions

I found out that in order to open a Gmail compose screen you'd have
I'm trying to write a chrome extension that is used in the GMail compose
Using Deepzoom Composer creates a nice ClientBin and a nice HTML page that works
Some Java APIs provide a large number of interfaces and few classes. For example,
I have been writing several class templates that contain nested iterator classes, for which
I am working on a quite large C library that doesn't have any tests
I'm writing a program that uploads huge amounts of data and I need to
If I have a large method that is composed of two small methods: public
Now, I have a application that composed of single master and many workers. The
I've created a compose note button that when clicked displays an initially hidden div

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.