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

The Archive Base Latest Questions

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

IM writing some html which provides a preview function for a list of URLs.

  • 0

IM writing some html which provides a preview function for a list of URLs. I want to use an iframe for this functionality,

The issue arises when some of the URLs are broken (returning a 500 error) or when a page contains some authenication process which the requesting user cannot satisfy. In these situations the iframe is trying to display the URL but the content returned in the frame is useless (500 error or authenication error ) to the user.

DOes iframe have any built in error handling for these senarios or is there some other way i can display a generic error page if something happens when loading the iframe?

Thanks

  • 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:02:48+00:00Added an answer on May 26, 2026 at 12:02 pm

    AFAIK, there is no way to directly access the header of a response to a request initiated by an iframe (or indeed, any request) in client side script.

    This is slightly convoluted, but I think it would work:

    1. The iframe is initially loaded with a URL that refers to a script on your server, and your pass the actual URL as a GET parameter.
    2. The server side script takes that URL, and sends a HEAD request to it (following 3xx redirects).
      • If the response code for the HEAD request is >= 200 and < 300, send some script back to the client which changes the iframe’s src to the actual URL (you might be able to do something as simple as window.location.href = but I’m not sure without testing).
      • If the response code is >= 400, send a page that says “This page is not loading at the moment”.

    If you know PHP/have it available on your server, I can try and provide a code example.

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

Sidebar

Related Questions

Often when writing PHP I'll have it output some HTML like this - echo
I am writing a component for a web app which will display some html,
This may not be possible without writing some crazy extension method which I do
I have an application that I'm writing, which gets some HTML from a website.
Writing documentation in html requires some code examples. What to do with characters that
Writing some test scripts in IronPython, I want to verify whether a window is
So I was writing some code today that basically looks like this: string returnString
I'm having a go at writing some C# code which overrides the Render method
I am writing a some code that to dynamically include an HTML snippet in
I'm currently writing an app that posts some data to a HTML form and

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.