Angular Fallback Image With Status Code - angularjs

I'm trying to get a fallback image working that behaves differently based on the status code. My images are coming out of SharePoint and in certain (Microsoft) browsers I have to request the images through a Web API so that I can append the proper authentication cookies.
I already have a fallback working that if an image fails it requests the image through the Web API and gets the Base64 representation. The problem is there's no point doing this if the image isn't there. So if it's a 404 I'd like to just display the placeholder, but if it's a 302 I'll get the image a different way.
Checking the error object and all the fallback directives I can find, I can't see a way to find out the error code.
Thanks!

Related

React SPA using react router on S3 with Cloudfront. Can't refresh or direct load link

I have a React SPA app that is on AWS S3 and I'm using Cloudfront. I was getting 404 errors if I refreshed or attempted to directly load any URL other than the root. I have read on other answers that I need to set up a custom error message on Cloudfront to redirect to index.html and show 200 OK.
I have done that and I am no longer getting the error message but now I just get shown a white screen. From what I have read this fix seems to work with everyone that has tried it. Does anyone know what I might be doing wrong or how I can fix it?
You have to let the index.html page handle direct paths such as example.com/path in your cloud front as well, you can do this by adding your custom error response in the cloud front.
Click the ID of your newly created distribution to reach its settings page, then click on the Error Pages tab. Select Create Custom Error Response.
Select Yes for a custom error response, set/index.html for the response page path and 200: OK for the response code. This custom error page in the CloudFront distribution is analogous to the Error Document on the S3 bucket (and will work on IE, too). When done, click Create.

How do I find Image resource while doing web performance test

I am creating Web performance test for an Angular Application using Visual Studio, which contains image logo. I’m receiving an error like: “No resource found” related to that image logo after recording its web URL, while testing that URL as shown in the below picture. Can you give any suggestion for this problem?
From what I can see, you have the link to the image as
app/home/app/assets/images/AzureAppServiceLogo.png
notice that app is in the absolute path twice, and this is probably what's causing the 404 error.
Let me know if this resolves the issue

HTTP images over HTTPS using angularjs

whenever I visit my angularjs based website that loads images (http images on a https server) I get warnings in the console saying that mixed content has been blocked. And those images do not show up
It is not my browser because it happens on other browsers too and on other systems, it is not the server, because another website that does not use angularjs works fine. So I think it is related to angularjs.
I already did this:
$sceDelegateProvider.resourceUrlWhitelist([
'self',
'http://images.RESOURCE.net/*'
]);
but it does not do anything. Moreover I tried loading them over a protocol-less url so //images.RESOURCE.net
This causes them to be loaded over https but then the server identify of the image server could not be validated and it also does not work.
Is there anyone who can determine the actual problem, is it angularjs and can angularjs fix it? It is almost impossible to remove angularjs from the project at the current state.
Thanks
-xCoder
This is not a limitation of Angular. Modern browsers block the loading of mixed (http) content over a secure (https) connection. This can be addressed by adjusting settings in your browser of choice.
Enabling Mixed Content by Browser:
IE: http://wiki.sln.suny.edu/display/SLNKB/Enabling+mixed+content+in+Internet+Explorer
Firefox: http://wiki.sln.suny.edu/display/SLNKB/Enabling+mixed+content+in+Mozilla+Firefox
Chrome: http://wiki.sln.suny.edu/display/SLNKB/Enabling+mixed+content+in+Google+Chrome

How to make Http Post request using CefSharp

I have a WPF application where I use CefSharp Browser control to render web pages. I need to be able to perform an HttpPost and open the uri. I looked through CefSharp documentation and haven't found any concrete examples to achieve this functionality but I'm sure this may be a feature that is part of the CefSharp component. Any pointers to how to achieve this would be quite helpful.
Thanks
Are you getting a Url back from your Http Post or some HtmlContent ?
The HttpPost either way has nothing to do with the Web Browser Control.
You can make an Http Post outside of the control, which in turn would return you the html content, and you would use CefSharp to display the content returned using the LoadHtml function, or if you are getting a Url back from your post, then you just need to set the Url of your webbrowser wpf control to the Url returned by your Http Post.

Work around for google app engine image serving webp to unsupported clients?

I want to call attention to this issue which is almost a month old and hasn't been acknowledged:
https://code.google.com/p/googleappengine/issues/detail?id=9940
I'm wondering if there's any plans to fix or known workarounds - e.g to force the images to be served in jpg format always via some url modification.
Full issue description below
We've had some complaints that in Firefox and Safari images aren't showing up. These images have urls that were returned from the get_serving_url(blob_key, ... function listed here:
https://developers.google.com/appengine/docs/python/images/functions
For example, this image:
http://lh6.ggpht.com/b8DBpggeo8eZ7TMlJiUJFnMUuBXIkDe_5NZaEtpjfNh9_1BMjxReNBIyU9WMhhb96LDuzndsvdqBaiDiIGIJ=s470-c
Was not rendering in Safari - upon closer inspection using the developer console, I could see it was being served with content-type 'webp', even though Safari isn't saying it accepts image/webp in the request 'accepts' header. Attaching a screenshot of the request / response headers of an image served as webp to safari.
Unfortunately the issue is intermittent - the same image when loaded later may be served as a jpg.
Is it possible the image serving infrastructure is improperly sending back webp images even when the accepts header isn't present? Or perhaps there's some caching server along the way that isn't taking the accepts header into account?

Resources