Render FBML in Facebook Dialog Popup - facebook

I'm working on a facebook page where there is a table of profile images. Onclick for each of these images, I'm using a facebook dialog to show the name, a picture and a description in a popup.
The name is stored in the <img> name attribute.
The description is stored in the <img> title attribute.
The img src is stored in the <img> src attribute.
So onclick, all of this data is gathered from the image that was clicked on and should be spit out in a dialog.
The problem is I can't get the dialog to render FBML, it just shows it as plain text.
Here's a portion of the FBJS:
function showDialog(element) {
var img_src = element.getFirstChild().getSrc();
var name = element.getFirstChild().getName();
var desc = element.getFirstChild().getTitle();
var msg = '<img src="' + img_src + '" width="160" alt="' + name + '"> ' + desc;
new Dialog().showMessage(name, msg);
}
and the FBML where the function is called:
<img src="http://mydomain.com/path/to/my/image.jpg" border="0" name="myName" title="My Description" width="160">
For example, in this case the dialog would display the following plain text, rather than the rendered FBML I am trying to display:
<img src="http://mydomain.com/path/to/my/image.jpg" width="160" alt="myName"> My Description
How can I get the dialog to render FBML rather than just plain text?

The Facebook Developer Page says "title and content can be either strings or pre-rendered FBML blocks". I'm not really sure what is meant by "pre-rendered". It could be an <fb:js-string>. Unfortunately the fb:js-string does not work in static FBML pages due to a Facebook bug (I think).

Related

Add html tags with custom text on facebook sharer link. Link https://www.facebook.com/sharer.php?quote=CUSTOM_TEXT

I want to use html tags like <a></a>, <br> tags, in custom text like
$text = Hello<br>World
https://www.facebook.com/sharer.php?u=$current_url&t=title&quote=$text

How to display image on web browser which returns from api response in ionic 2

I want to display image on web browser, the image file returns from api response. if we want to display image in device then we can download it, store it in device memory and we can display it. but how can we display image in web browser? is there any way to download and store image in browser?
what i have tried is below...
this.sProvider.getLogo(this.logoHeaders)
.then(result => {
console.log("getLogo " + JSON.stringify(result));
this.img = result._body;
});
html
<div>
<img src="{{img}}" >
</div>
You need to use [] to bind src for <img> tag :
<img [src]="img" />
Try it.
<img [src]="img" >
If it is not works kindly send What do you get result here?
this.img = result._body;

Tumblr Photo/Photoset popup

The theme I use lets photoset images pop up to the grey gallery slide show.
If I post only a single photo nothing happens, even when I insert a clickthrough URL.
I'd like to have the grey slide show gallery for all images.
On the dashboard it works, but not in the theme.
I think there's some code missing, but I don't know it.
Could somebody have a look on it, please?
I use this theme http://mindspalace.tumblr.com
There's no official way for doing this, but you could 'piggyback' tumblr's Lightbox function Tumblr.Lightbox.init() since it's already loaded on your blog for photosets.
It accepts an array containing the urls of all the photoset images, but in this case there is only one image so you can just pass that.
A quick edit of the javascript tumblr appends to every photoset, to allow single photos:
<script class="inline_embed" type="text/javascript">
var domain = document.domain,
photo_{PostID} = [{
"width": "{PhotoWidth-HighRes}",
"height": "{PhotoHeight-HighRes}",
"low_res": "{PhotoURL-250}",
"high_res": "{PhotoURL-HighRes}"
}];
function event_is_alt_key(e) {
return ((!e && window.event && (window.event.metaKey || window.event.altKey)) || (e && (e.metaKey || e.altKey)));
};
document.getElementById('photo_{PostID}').onclick = function (e) {
if (event_is_alt_key(e)) return true;
window.parent.Tumblr.Lightbox.init(photo_{PostID});
return false;
}
</script>
In the Edit HTML screen of your theme's Customize, search for the {Block:Photo} and inside, look for the <img or {PhotoURL tag. You'll need to add an id="{PostID} to the <img /> so it will resemble something like this:
<img id="photo_{PostID}" src="{PhotoURL-500}" />
Once you've done that, copy the modified javascript code block at the top and paste it after the image code, and save. When you click an image post, it should bring up the Lightbox that tumblr uses for photosets and show the vignette background.
Creating a custom HTML theme

Scale Web Viewer to fit box (reduce or enlarge to fit)

Rather than have to upload/copy across each individual image in my table, I want to display the images based on their image url (which I have). With ordinary images one can check "reduce or enlarge" (Inspector>Format) in order for images to fill the box (even if they are of different sizes). I can use the Web Viewer to create a box which includes the image, but I can't edit Format in the Inspector.
How can I fill the Web Viewer box with the image from a url (which ends in .jpg)?
You can specify the image height and with within the Web Viewer using either HTML or CSS. A simple example of this using inline CSS could be something like this:
"data:text/html,
<img src='" & Image::URL & "' style='width:100%; height:100%;' />"
You can specify the image height and width within the Web Viewer using HTML and CSS. If the ImageURL was referenced in Image::URL you could include it as follows:
"data:text/html, <style type='text/css'>
/* Remove margins from the 'html' and 'body' tags */
html, body {height:100%; margin:0; padding:0;} </style>
<img src='" & Image::URL & "' style='width:100%; height:100%;' />"
Uncheck "Allow interaction...", "Display progress bar" and "Display status messages" (in the Web Viewer Setup)

Facebook Like Button Popup doesn't load

This is my first question asked, so if I leave out details please be a little lenient. Thanks!
I am using the Facebook Like Button plugin on my site (tried both HTML5 version and xfbml version). I have included all necessary tags and scripts for xfbml and HTML5 support. I have followed the "spec" and done a thorough amount of searching here and elsewhere to the problem:
The like button functions correctly, except that the flyout/popup that is supposed to show after clicking the button doesn't load. I mean load, not show (and yes I already checked for overflow:hidden issues per the spec). The new <span> (which includes the <iframe>) are added to the DOM immediately after the like button <span>, and they load all of the code that is supposed to be there:
<span class=" fb_edge_comment_widget fb_iframe_widget " style="top: 19px; left: 0px; z-index: 10000;">
<span>
<iframe id="fa02aa64d8da" class="fb_ltr" scrolling="no" name="fee6eb9f6f2768" style="border: medium none; overflow: hidden; height: 225px; width: 401px;" src="http://www.facebook.com/plugins/comment_widget_shell.php?api_key=233493930007947&locale=en_US&master_frame_name=fa12240bc73214&sdk=joey">
<html>
<head>
<body onload="onPageLoad()">
<script>
var onPageLoad = function() {
document.domain = 'facebook.com';
var loc = window.location.toString();
var index = loc.indexOf('?');
var qs = loc.substring(index + 1);
var params = qs.split('&');
var master_frame_name = '';
for (var i in params) {
var components = params[i].split('=');
if (components[0] == 'master_frame_name') {
master_frame_name = components[1];
break;
}
}
try {
var master_frame = parent.frames[master_frame_name];
master_frame.ExternalNodeConnectWidget.onCommentWidgetLoaded(document);
} catch (e) {}
};
</script>
</body>
</html>
</iframe>
</span>
</span>
Now after that <span> is loaded it is supposed to fire the script function onPageLoad which should load all of the data into the <iframe>. Instead I get a bunch of errors:
There is the infamous Unsafe Javascript attempt to access frame with URL
When you manually run the onPageLoad() function (in hopes of it loading the content into the iframe) in the console/Firebug, you get
(in Chrome 15)
Error: SECURITY_ERR: DOM Exception 18
code: 18
message: "SECURITY_ERR: DOM Exception 18"
name: "SECURITY_ERR"
__proto__: DOMException
(in Firefox 7)
Error: Illegal document.domain value
document.domain = 'facebook.com';
I presume this has to do with cross-domain requests, but it seems like for other people, they just get the error but the popup still loads properly. Any ideas how to get this to work?
This is a known Facebook bug: http://developers.facebook.com/bugs/293075054049400
Basically, one gets this behavior if secure browsing is enabled on the Facebook user's account.
If you have secure browsing disabled (as it is default) here is another possible solution:
You cannot use localhost in the og:url since Facebook cannot surf that page to get the data. So when developing, enter the live site URL in og:url, og:image, the like/share button url etc. Even that might not help, the click needs to be made on the live site, when I deployed it worked fine.
Anyone know a work around for this to make it easier when developing locally?