Home > http error > errorpage.aspx status= 500 error = iframe

Errorpage.aspx Status= 500 Error = Iframe

Contents

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack http error codes list Overflow the company Business Learn more about hiring developers or posting ads with us iframe onerror Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community http error codes 404 of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up catching a 500 response when setting the src of an iframe up vote 0 down vote

Http Error Codes Cheat Sheet

favorite I'm doing something similar to this code: $('#myIFrame').attr('src', 'dosomethingthatreturnsadocument.aspx'); The page that gets called returns a document, whether that be a word doc, pdf etc and prompts the user to open/save and generally that is working fine. The problem I have is if something goes wrong at the server side a 500 response is returned. I don't seem to have any way of catching the error. I've tried a try catch iframe 404 error handler around that line. The .error function of the iframe doesn't seem to catch it. Does anyone know of a good way that would allow me to catch the 500 so I can act accordingly with the UI? javascript c# jquery webforms share|improve this question asked Jun 13 '15 at 17:56 Simon 3481417 Duplicate of existing question? stackoverflow.com/questions/15273042/… –Roy J Jun 13 '15 at 18:00 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote You should first check the response and then set it in the iframe. You can try something like this: var loading_url = "/dosomethingthatreturnsadocument.aspx" $.ajax({ url: loading_url, type: 'GET', complete: function(e, xhr, settings){ if(e.status === 200){ $('#myIFrame').attr('src', 'dosomethingthatreturnsadocument.aspx'); }else if(e.status===500){ // do something } } }); share|improve this answer answered Jun 13 '15 at 18:06 Vivek Sadh 3,09711124 This is an issue for a long running report page though? –Simon Jun 13 '15 at 18:24 add a comment| up vote 0 down vote You can check the content of the iframe with jQuery immediately after it's loaded and check if it is an error page, by for example checking the title of the page. $(".loadbutton").on('click',function(){ $(".iframe").attr("src", "http://www.example.org/") .load(function(){ if($(this).contents().find("title").first().text() == "error"){ //Error occured! }else{ //Works! alert( "loaded!" ); } })

Learn Bootstrap Learn Graphics Learn Icons Learn How To JavaScript Learn JavaScript Learn jQuery Learn jQueryMobile Learn AppML Learn AngularJS Learn JSON Learn AJAX Server Side Learn SQL Learn PHP iframe onerror not working Learn ASP Web Building Web Templates Web Statistics Web Certificates XML Learn XML

Jquery Iframe Load Error

Learn XML AJAX Learn XML DOM Learn XML DTD Learn XML Schema Learn XSLT Learn XPath Learn XQuery × HTML

Http Error Codes List Pdf

HTML Tag Reference HTML Event Reference HTML Color Reference HTML Attribute Reference HTML Canvas Reference HTML SVG Reference Google Maps Reference CSS CSS Reference CSS Selector Reference W3.CSS Reference Bootstrap Reference Icon http://stackoverflow.com/questions/30821815/catching-a-500-response-when-setting-the-src-of-an-iframe Reference JavaScript JavaScript Reference HTML DOM Reference jQuery Reference jQuery Mobile Reference AngularJS Reference XML XML Reference XML Http Reference XSLT Reference XML Schema Reference Charsets HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 HTML Symbols HTML UTF-8 Server Side PHP Reference SQL Reference ASP Reference × HTML/CSS HTML Examples CSS Examples W3.CSS Examples Bootstrap Examples JavaScript JavaScript Examples HTML DOM http://www.w3schools.com/tags/ref_httpmessages.asp Examples jQuery Examples jQuery Mobile Examples AngularJS Examples AJAX Examples XML XML Examples XSLT Examples XPath Examples XML Schema Examples SVG Examples Server Side PHP Examples ASP Examples Quizzes HTML Quiz CSS Quiz JavaScript Quiz Bootstrap Quiz jQuery Quiz PHP Quiz SQL Quiz XML Quiz × HTML Reference HTML by Alphabet HTML by Category HTML Attributes HTML Global Attributes HTML Events HTML Colors HTML Canvas HTML Audio/Video HTML Character Sets HTML Doctypes HTML URL Encode HTML Language Codes HTML Country Codes HTTP Messages HTTP Methods PX to EM Converter Keyboard Shortcuts HTML Tags