Change open graph title dynamically before sharing on Facebook - facebook-opengraph

How do I change open graph title dynamically before sharing on face book?
The code is
FB.ui(
{
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object: {
'og:url': myurl,
'og:title': mytitle,
'og:description': mydescription,
'og:image': myimageURL,
},
}),
},
function(response) {
console.log(response);
// Action after response
},
);

You canĀ“t, that option was just a workaround that does not work anymore. You must provide correct OG tags in the source of the shared URL.

Related

Firebase dynamic link acting differently if generated on iOS (React Native) vs REST API

We have a functionality to generate dynamic links to our app on iOS using React Native, which works perfectly (identifiable data redacted by replacing them with "our app"):
dynamicLinks().buildShortLink({
link: `https://our_app?referral=${referralCode}`,
domainUriPrefix: 'https://ourapp.page.link',
android: {
packageName: 'app.ourapp.mobile',
},
ios: {
appStoreId: 'XXX',
bundleId: 'app.ourapp.client',
},
navigation: {
forcedRedirectEnabled: true,
},
});
It correctly opens the app if installed, and App Store if not installed.
I need to implement the same functionality on web site, here's my code:
const payload = {
dynamicLinkInfo: {
link: `https://our_app.app?referral=${referralCode}`,
domainUriPrefix: 'https://ourapp.page.link',
androidInfo: {
androidPackageName: 'app.ourapp.mobile',
},
iosInfo: {
iosBundleId: 'XXX',
iosBundleId: 'app.ourapp.client',
},
navigationInfo: {
enableForcedRedirect: true,
},
}
};
// generate page link and redirect there
const result = await fetch('https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=OUR_API_KEY', {
method: 'post',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
It's the same (with parameter names from React Native changed to REST parameter names respectively, as documented at https://firebase.google.com/docs/reference/dynamic-links/link-shortener)
A link is generated, however when clicked, if the app isn't installed, the page link redirects our website instead of App Store.
When I debug both links using ?d=1 query string parameter, I can indeed notice the difference:
(left: in-app generated, correct. right: REST-generated, incorrect)
Why are these links, generated with the exact same parameters, behaving differently and how can I make the second one work exactly like the first one (redirect to App Store instead of our website)?
After examining closely I've found a typo:
While generating the link in the second example, I was mistakenly using the same key twice:
iosInfo: {
iosBundleId: 'XXX',
iosBundleId: 'app.ourapp.client',
},
Changed the first one to iosAppStoreId and it worked.

Extjs Iframe - displays "cannot connect error message"

I have an extjs iframe created as below which gets rendered onto a page when called using its xtype. However, the page displays "cannot connect to" the URL I specified in src parameter error message. But if I access the URL which I have in src parameter directly from the browser, I am able to access it. What is the issue here? Any suggestions would really help!
Ext.define('myComp', {
extend:'Ext.container.Container',
xtype: 'iframe'
itemId:'iframe204'
requires: [
'Ext.ux.IFrame',
],
layout:'fit',
height:'100%',
initComponent:
function() {
this.items = [];
this.items.push({
xtype:'uxiframe',
itemId:'myframe',
height:'100%',
src: someURL
});
this.callParent(arguments);
},
});

Extjs Iframe - Passing credentials (is it possible to pass username/pwd?)

I have an extjs iframe created as below which gets rendered onto a page when called using its xtype. The URL I use in the src parameter redirects to a login page. Is it possible to pass the username and pwd along with the URL in someway so the content from that URL gets embedded directly without having to see the login screen first? If so, how can this be achieved?
Ext.define('myComp', {
extend:'Ext.container.Container',
xtype: 'iframe'
itemId:'iframe204'
requires: [
'Ext.ux.IFrame',
],
layout:'fit',
height:'100%',
initComponent:
function() {
this.items = [];
this.items.push({
xtype:'uxiframe',
itemId:'myframe',
height:'100%',
src: someURL
});
this.callParent(arguments);
},
});

Not able to upload file by using dropbox on cordova app based on meteor

I want to use dropbox to upload files on my cordova app based on meteor i.e., user will be given option if he wants to upload file using dropbox if user click on the button then inappbrowser should open from where user will be authenticated and can upload file.
I am using below script
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="id_dropbox" data-app-key="xxxxxxxxxxx"></script>
This is the code
e.preventDefault();
Dropbox.choose({
linkType: "direct",
multiselect: false,
extensions: ['.doc'],
success: function(files) {
console.log("files ", files[0]);
if(files[0]['bytes']<1000000){
GetBlobDataDropbox(files) //function to upload file
}else{
alert('Size should be less than 1 mb')
}
},
error:function(error){console.log(error)},
cancel: function() {}
});
This is giving me below error.
maximum call stack size exceded.
Please tell how to resolve it.
This is the template code around my code. I am not using helper on this template.
Template.AttachResume.events({
'click #dropbox' : function(e){
console.log('dropbox123 ',Dropbox)
e.preventDefault();
Dropbox.choose({
linkType: "direct",
multiselect: false,
extensions: ['.doc', '.docx', '.pdf', '.rtf', '.txt', '.odt'],
success: function(files) {
console.log("files ", files[0]);
if(files[0]['bytes']<1000000){
GetBlobDataDropbox(files)
}else{
alert('Size should be less than 1 mb')
}
},
error:function(error){console.log(error)},
cancel: function() {}
});
},
})

How to change page title dynamicly without refresh site

i wanna have a Faceook-Feature in my website: Everytime a user gets a Private Message, the title should be change in something like "[1 PM] TITLE",
How to do that?
I know its easy to change the page-title, the question is how to run a database query every 10 seconds (or is that to often?) and change the title - Without an user interaction (ajax?)
You can use jquery setInterval to make a AJAX request after a certain interval to get data from the db.
$(function(){
setInterval(function() {
$.ajax({
url: "page.html",
success: {
document.title ='new title';
},
error: function(){
//error occurred
}
});
}, 2000);
});
And on AJAX success you can change the page title.

Resources