This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Fb.UI Dialogs are displaying in Popups instead of an iframe
I got this code for application request dialog:
FB.ui({
method: "apprequests",
message: "You have a gift! Click accept to see what it is!",
data: gift, //This will be passed back to you when a user accepts the request
title: "Send "+giftname+" to 50 friends!"
},
function(response) {
if (response && response.request_ids) {
alert('Your gift has been sent!');
} else {
alert('You must select some friends to send gifts to!');
}
});
and it seems like the dialog is opening in a new window. I don't want this, I would like to popup the request dialog within a Facebook Styled POPUP, same happens with the feed dialog.
Try setting display="iframe" per this guide but when you need to prompt users for extended permissions you normally can't use iframe.
Related
I am working on testing paypal checkout stuff using cypress. But the problem is that when the PayPal popup window opens, I don't know how to access these popup window elements. Can anyone help me to resolve this issue
Without a sample of the html, this will be a generic answer.
You will have to get the iframe of paypal, then drill down to its contents to be able to search within the paypal window elements.
cy.get('iframe')
.its('0.contentDocument.body')
// now you can search within the paypal window
In case you have any clicks you need to do, you may be redirected to another window, in which case you will have to use cy.origin().
cy.origin('paypal.com',
{ args: sentArgs },
({ url }) => {
const path = url.split('com/')
cy.visit(`/${path[1]}`)
)
I want to program a simple Outlook add-in that opens a browser and take the user to a specific site.
I've had a look at using Yeoman, but this add-in opens a task pane where I'm just looking to take that single actions.
Is there a simple way to do this?
EDIT:
I managed to get this done, but I not have the following issue: I have a single button (via Yeoman's generator) that when clicked executes the following:
function action(event) {
const message = {
type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
message: "Window opened.",
icon: "Icon.80x80",
persistent: true,
};
// Show a notification message
window.open("https://myurl.com");
Office.context.mailbox.item.notificationMessages.replaceAsync("action", message);
// Be sure to indicate when the add-in command function is complete
event.completed();
}
I get the following error in Outlook itself:
We deployed the app using the MS 365 admin center, but I'm not sure if there is something additional that I need to do in this case to run the webserver?
There is an Office.js API that will open a browser window:
Office.ui.openBrowserWindow( -- URL string here -- );
This will cause the computers default browser to open to the specified URL. You could have a button in the task pane whose handlers calls this method. Alternatively, you could have a custom button on the ribbon that calls a FunctionFile that calls this method.
If you want to display any web site to the user as a result of the button click or some action on the pane, try doing window.open('https://yoursite.com'). This should work if the domain is whitelisted in your manifest. For example:
function redirectFunction() {
window.open("https://othersite.com")
//window.location.href = "https://othersite.com";
}
I am developing a popup extension where I want to execute an action after user confirmation when my popup exits. I tried the following code in my background script
browser.runtime.onConnect.addListener(function (externalPort) {
if (externalPort.name === 'myport') {
externalPort.onDisconnect.addListener(function () {
if (confirm("are you sure?"){
doIt();
}
});
}});
but then I get an error: TypeError: window.gBrowser is undefined. Evidently, I cannot have a dialog in my background script. Is there a reliable way to do this?
Addon's background page cannot show a confirmation dialog directly, it is a restriction of WebExtensions. There are some workarounds:
Run a content script including confirm() in the active tab.
Open a dialog window with browser.windows.create({ url: 'dialog.html', type: 'popup' }); and communicate with the background page with WebExtensions APIs like runtime.connect() or runtime.sendMessage().
Im creating an Electron app. I save the user progress in a file. I want the app to show the usual 'Save changes before closing' when the user has not saved and tries to close the App.
I could show a custom dialog, however, I would want to do it the native way.
(Example: On macOS, when you edit a file, the red button changes, letting know the user that the app has unsaved content)
I know this has to be done probably inside the Electron's listener for a closing app:
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
... preventing quit() from being called. And instead handling the unsaved file state and dialog.
PD: I already handle the logic to know whether the user has saved its progress or not. I just want to know how to set the 'Unsaved' state to my electron app and correctly handle it.
(The example is Visual Studio Code, which is also an Electron App)
I usually use a global variable to indicate changes had occured and for example in the case of closing the app:
Code in the main:
mainWindow.on('close', function (event) {
if (global.savetoask== 'Yes') {
event.preventDefault();
//send a ipc message to request a confirm dialog
.............
} else {
app.exit();
}
});
I am trying to integrate https://oauth.io/ into my application. Below is the code for facebook integration that I am using:
OAuth.popup('facebook')
.done(function (result) {
alert('sucess');
})
.fail(function (error) {
alert('fail');
});
Note: I am calling the above part of code in a button click.
In JQuery ready function I am calling OAuth.initialize("my_public_key");
When I click on the button I am getting "The parameter app_id is required" error in the popup. (added image of it)
Can someone let me know If I am missing something.
You must Integrate APIs in OAuth, follow the below method.
Login to your account.
Then click on the Integrated APIs menu from the left side bar.
Now click on ADD APIs green button on the right top corner.
Now Search and select Facebook.
Now add the Keys and Permission Scope details and others.