Facebook oEmbed width - facebook

I'm trying to make a request for a Facebook oEmbed but it seems I'm unable to request a responsive width. It looks like the legacy API returned a responsive response, but the current API only seems to allow for a 'maxwidth' param to be passed, which in turn returns a hard-coded set width. Omitting 'maxwidth' returns a default 552px width response.
Is there anyway to get it to return a responsive width?

Related

How to call an backend api and fetch result to show on react admin dashboard?

I have an API for my backend which gives some JSON data in response. React Admin allow data to be shown using a DATA provider. I have tried all the data provider but none of them give me the results.
I have this API Method:
GET http://localhost:8081/customer/status/{phone_no}
which gives response as :
[
{
"mobile_number": "98160******",
"status": true
}
]
So here I want to get this data in my list view and show it on the dashboard. Is there any way to do this. I have also used the jsonDataProvider. It is not also working.
I need this to be fixed very soon. If someone know how to do that pls ping.
What error is it giving you? Use the developer tools to see the errors.
Most of the time, it is probably that you need to add Content-Range header to your API:
See below documentation from the Data Providers section:
Note: The simple REST client expects the API to include a Content-Range header in the response to getList calls. The value must be the total number of resources in the collection. This allows react-admin to know how many pages of resources there are in total, and build the pagination controls.
Content-Range: posts 0-24/319
If your API is on another domain as the JS code, you’ll need to whitelist this header with an Access-Control-Expose-Headers CORS header.
Access-Control-Expose-Headers: Content-Range
Thanks

Dynamic images won't load, shows up as text/html MIME type, fix for webview?

For example, a link for one of the images goes to a url https://storage.notmywebsite.com/some/path/on/website/image:Static,Small/ImageFileName?params=123456.
When degbugging webview via chrome://inspect, the kind of error that shows up is ...
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://login.notmywebsite.com/login.srf?moreparams=123456&wreply=https:%2F%2Fstorage.notmywebsite.com%2Fstorageservice%2Fpassport%2Fauth.aspx%3Fsru%3Dhttps:%252f%252fstorage.notmywebsite.com%252fsome%252fpath%252fon%252fwebsite%252fimage:Static%252cSmall%252fImageFileName&otherparams=123456 with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
However, loading the same website in the Chrome web browser, those images show up... so what is going wrong? Is there any way to fix this?
I finally figured out what was wrong.
For the webview, it needs one more setting turned on in order for the cookies of the website to be used in order to access credential protected images.
So, if you want to fix it for your application, just use the following code.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
else
CookieManager.getInstance().setAcceptCookie(true);

BOX API, use Box javascript preview SDK to read all files in my box account

I'm trying to use Javascript Preview SDK to read all files in box account from my web application. I would like to see a preview of all files on my box account from my custom web application. There is some way to use a default ID that allow me to read all folders and files in the box account?
Currently, I'm trying to use:
Box.Preview.show('FILE_ID',{
token: access_token,
container: '.preview-container',
showDownload: true
});
The access_token is obtained through the procedures described in this page. Besides, using the code above I obtain this error:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
How can I set request header using Javascript Preview SDK?
Thank for the response.
You have to add the URL of your app (http://localhost:3000) to the CORS Allowed Origins text area. You can find this field in the form you used to create your application, the same form where you also obtained the Developer token. Note: Avoid the use of trailing slashes in the URL.

Firefox SDK: Get type of observed http request

I need to intercept HTTP request done by Firefox to set an additional header to the request (like described here: https://developer.mozilla.org/en-US/docs/Setting_HTTP_request_headers) - but I only want to do this if a Javascript resource is requested (or, equivalent, the request got triggered by an <script>tag).
In case of Javascript this sadly cannot be done via looking at the set "accept-encoding" header because this is set to "/".
I already analyzed the objects I get handed over when a request is done - but I cannot find the needed information in there.
Does anybody know how one can detect this?

Facebook profile-pic with SSL link

I have html code containing FB profile pictures/clicable and etc/.
Using
fb:profile-pic and FB.XFBML.parse
I receive image url with HTTP. To have HTTPS I'm using:
https://graph.facebook.com/user_id/picture?return_ssl_resources=1
but have to generate code to make image clickable and add other attributes existing in fb-profile-pic.
I wrote this code 4 months ago.
Now I'm seeing fb:profile-pic is returning HTTPS link to image. Nothing is mentioned in FB documentation about change in behaviour/HTTP or HTTPS/.
Does anybody know about current state FB.XFBML.parse - secure or non secure links?
By default the protocol of the returned profile picture URL is the same as the protocol used to request the image.
So https://graph.facebook.com/zuck/picture will return the SSL version of Mark’s profile picture, while http://graph.facebook.com/zuck/picture will return an HTTP URL.
return_ssl_resources can be used with both, with value 0 for an HTTP and 1 for an HTTPS URL.
Does anybody know about current state FB.XFBML.parse - secure or non secure links?
I think the JS SDK should be able to decide this automatically, based upon the protocol the embedding page was requested with.