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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:27:14+00:00 2026-06-05T08:27:14+00:00

I wonder, how can I display HTML content using Javascript, from what I know

  • 0

I wonder, how can I display HTML content using Javascript, from what I know and been searching it’s simply not possible to do that.

But I have found a javascript code, that is displaying HTML content (not raw) when there is frame in the URL parameters.

Here it is:

http://otslist.eu/ratingWidget.js – Here you can find the raw javascript code.

http://otslist.eu/ratingWidget.js?frame=1 – And here it is displaying the HTML.

How is that possible? How to do something like that?

  • 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-05T08:27:15+00:00Added an answer on June 5, 2026 at 8:27 am

    The JavaScript you see is a PHP script on the server. Use some browser/network debugger tool to check the HTTP response:

    HTTP/1.1 200 OK 
    Server              nginx/0.7.67
    Date                Wed, 06 Jun 2012 11:50:44 GMT
    Content-Type        text/html
    Connection          keep-alive
    X-Powered-By        PHP/5.3.10
    Expires             Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control       no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma              no-cache
    Content-Encoding    gzip
    

    and see that it is powered by PHP. So it is the output of a PHP script and not a regular JavaScript document.

    The PHP script outputs a JavScript when frame=1 is omitted.
    When the frame=1 is included, it tells the PHP script to embed the JavaScript into an HTML page and serve that.

    Update: The PHP script could look like this:

    <?php
    $asHTML = $_GET['frame'] == 1;
    
    if($asHTML) {
      // Generate HTTP headers for HTML, like
      header("Content-Type", "text/html");
    } else {
      // Generate HTTP headers for the JavaScript, like
      header("Content-Type", "text/javascript");
    }
    
    if($asHTML) {
      // Generate HTML top document part
      echo "<html><head><title>Title</title></head><body><script type=\"text/javascript\">";
      // Other HTML header stuff here as well, see the live example (as I am too lazy to type it here)
    }
    
    // Read the JavaScript from a file that is available on the server
    readfile("javascript.js");
    
    if($asHTML) {
      // Close HTML tags
      echo "</script></body></html>";
    }
    

    Note that I quickly typed this together, so it is probably full of errors. But it should give you the general idea.

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

Sidebar

Related Questions

I wonder if there is a service where I can clean-up html-code so that
I wonder how I can display a popOver from a tabBarItem ? Here is
Using PHPUnit, I wonder how we can have multiple expectation from the same stub/mock.
I wonder if it is possible to rearrange HTML table cells using only CSS.
I wonder if someone can help me. I'm trying to display a toast element
I want to generate html layout with areas (divs, spans) that can be shown/hidden
I wonder how can i accomplish the following: I would like to display the
I'm working under ASP.NET and I wonder if is possible to display a custom
I wonder how can I code this: //if there is any ajax request $("#loader").css("display","block");
I tried using this to display MIDI code on the console, found that memory

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.