First, this is for Swift 3.
I am creating a container app that simply serves a website.
The problem is that everything comes back fine and works, but the images are not showing. When debugging, it looks like the problem is that the webview isn't accepting images from an asp app site that uses a relative path to hit a .net api endpoint within the app. The image is served with the following tag:
<img src="api/Answers/Image/1006" class="panel-image" alt="">
All other functionality and data is coming back fine. The website works perfectly fine on all standard web browsers including safari. Any ideas on how to fix this.
You would think the webview would understand how to handle a relative url for an img tag... Adding protocol and host of the path to the api should solve your problem though.
If you are injecting the HTML, try something along the lines of this:
'<img src='window.location.protocol + '//' + window.location.host + '"/api/Answers/Image/1006" class="panel-image" alt="">'
Or... if you are setting it via id:
var img = document.getElementById("ImageId");
img.src = window.location.protocol + '//' + window.location.host + '/api/Answers/Image/1006';
Allen's answer was insightful on another nature of setting up a source, but I found that the back end developer for the site accidentally set the image api to require authentication. The odd thing is that this authentication didn't trigger on any device other than the ipad app. Even the browser didn't request authentication. Removing authentication on the image api fixed the problem.
Related
Hi im using Xamarin forms webview and i had a specific url which is developed by my company when ever im loading the url the webview is returning empty screen can someone help me with this?
First of all the URLs must be fully formed with the protocol specified (i.e. it must have "http://" or "https://" prepended to it).
var browser = new WebView
{
Source = "http://xamarin.com"
};
Check your webview layout. Maybe is not have a good position in xaml.
For ios check NSAppTransportSecurity if the url is not https.
If you want open the browser tab inside your app check this
https://askxammy.com/customizing-browser-appearance-in-xamarin-forms/
I'm building a webapp that I want to use on a FireTV browser (Firefox) and when I do so, my Facebook images are appearing as broken links.
The images appear normally on all other devices/browsers I've tested (multiple on OSX, Android)
Initially I thought the the firetv browser wasn't liking hot-linked images for some reason as I'm loading them via the graph API, however I'm able to get images hotlinked from other sites to show up just fine on the fireTV as well.... It seems to be something specific about the facebook URLs it doesn't like? Does anyone have any ideas, or know of any tools to help debug it better?
This is what the img elements look like that I'm rendering, for example:
<img src="https://graph.facebook.com/v2.6/112816289586034/picture?type=large" />
Facebook Graph API returns a profile photo URL with a 302 redirect, which apparently is not Amazon FireTV friendly.
The solution was to include redirect=false as a url parameter on the API request, which causes FB to return a JSON object including regular image url that loads as expected.
I'm trying to get the XUL browser in a Firefox app to display images from "file://" locations, from a page at http://localhost.
I'm running the app with Firefox 30.
I've tried this, but to no avail :
var branch = browser.preferences.getBranch("capability.policy");
branch.setCharPref("policynames", "localfilelinks");
branch.setCharPref("localfilelinks.sites", "http://localhost");
branch.setCharPref("localfilelinks.checkloaduri.enabled", "allAccess");
What's the correct way of allowing file links ?
I don't think it's a good idea run file:// content inside http://. Why can't you use chrome:// or http:// for the images. chrome:// URLs are easy to locate and they come always with your app.
I need to have an iframe script which I can give to my different clients, so that they can embed it in their sites. Just like Youtube or facebook does.
But it does not get rendered due to cross domain restrictions.
I have gone through every documentation for x - frame options , crossDomain ajax call.
The problem with crossDomain ajax call is that I have only JSONP to work with.
I have tried this - just go to any youtube video and get its Embed code. Its a plain iframe script e.g. <iframe width="420" height="315" src="http://www.youtube.com/embed/7N5OhNplEd4" frameborder="0" allowfullscreen></iframe>
If you inject the above script in your html, it will get rendered , but as soon as you edit the src of the iframe to youtube.com itself , it will go blank.
Facebook's iframe too gets rendered everywhere smoothly.
I am hell tortured by this thing.
Please guide me on this. Thanks in advance!
IF you look at the response headers from youtube.com it is returning "X-Frame-Options:SAMEORIGIN" so they are adding the header on the server to stop people from displaying youtube (website pages) via a iframe.
I have a QR code image that's embedded from the Google Charts API. Recently it stopped working, but I haven't changed anything in my code.
Here's the page (note the broken images): [redacted]
As you can see, the images are embedded as http:// but when they are loaded, they're redirecting to the https:// URL on the google domain, which is broken.
Why is this redirect happening?
Edit: forgot to add -- what's even stranger is that if you view the image in a new tab, then change http to https (in effect, making the url the exact one that was originally requested),
it loads fine.
Edit #2 removed the link to my test site, as I've fixed the problem.
Turns out the google charts domain has changed. The new one is:
https://chart.googleapis.com
do not use
http://chart.apis.google.com