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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:04:29+00:00 2026-05-31T07:04:29+00:00

I want to make a simple application having only one text field and a

  • 0

I want to make a simple application having only one text field and a preview button.

It should display the preview of the page in a div on the same page. Please see the blow code to get exact idea.

    <form method="POST" action="" id="preview-form" >
        <input type="text" id="urltopreview" name="urltopreview" />
        <input type="button" id="preview-button" value="Preview">
        <div id="preview"></div>
   </form>

When I insert the URL and click Preview button, it should load the preview of that page in the div (having id=”preview” ) using jquery & ajax.

I tried to use php function file_get_contents() to generate preview but I get broken images.

Any idea?

  • 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-31T07:04:30+00:00Added an answer on May 31, 2026 at 7:04 am

    You can use an hidden Iframe and set it source to the url entered in the textbox. Then, get the content of the iframe and append it to you preview div.

    function getContentFromIframe(iFrameName)
    {
    
         var myIFrame = document.getElementById(iFrameName);
         var content = myIFrame.contentWindow.document.body.innerHTML;
    
         $("#preview").html(content);
    
    }
    

    OR

    To load an internal page:
    You can use the Jquery method load()

     $("#preview").load($('#urltopreview').val());
    

    This Jquery method will not work to load external pages because ajax calls cannot retrieve external pages for security reasons. The only way to get external pages onto your page is to use an iframe, or a server side proxy that you can call with your ajax.

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

Sidebar

Related Questions

i have a simple chat application in flex 3 and i want to make
I'm creating a very simple django upload application but I want to make it
I want to make a really simple iphone app: one screen with a single
I am trying to make a simple timer application. I want the timer to
I am having a simple application with one entity. The entity is Car so
Basically I want to make simple toggle program (that will be mapped to some
I need information about making installation packages for Linux. I want to make simple
I want to make a simple app, where a UIWebView with custom content will
I want to make a simple game: 2d, single-player, without tons of animations and
I want to make a simple game so that I can play against my

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.