I am using Django-Webpush to send push notifications to users, where clicking on the notifications it opens the URL in a new tab.
What I want to do is to open the URL in a new popup window similar to:
window.open(href,'height=500,width=800,resizable=yes,scrollbars=yes');
I have searched and I cannot find a way to do this with self.clients.openWindow(). It simply opens the URL in a new tab, which is not useful to me.
Is there a way or an alternative to use in the notification event listener?
self.addEventListener('notificationclick', function(event){
event.waitUntil(
event.preventDefault(),
event.notification.close(),
self.clients.openWindow(event.notification.data.url)
);
});
After a deep research on the matter, I discovered there is currently (December 2020) no way for the openWindow() to open the notification link in a new window. It will always force the url to open in a new tab.
Related
I post simple message with cards_v2. I placed a Button with properties:
action: {
function = "myAction",
interaction = "OPEN_DIALOG"
}
When I click on button I receive event but no DialogEventType is provided.
I tried to reply with Dialog payload, but Google says bad response.
I used this: https://developers.google.com/chat/how-tos/dialogs?hl=en#apps-script
Dialog buttons works only if I send a response on message. When I posted cards through API POST it doesn't work.
I can't say is this a bug of Feature.
I am trying Model layout of Firebase in-app messaging. On model I have added one button. and for that button action, I have provided the firebase dynamic link. So when the user is clicking on button dynamic link is getting a trigger. and it's first opening the browser and after that, it's again coming to application. This interaction is not looking more natural. I want to open the new page on click of the action button. But on click of action button first browser is getting open. How to solve this issue?
You can implement FirebaseInAppMessagingClickListener in your mainActivity and initialize in onCreate() method using FirebaseInAppMessaging.getInstance().addClickListener(MainActivity.this);
for more details please click below link-
https://firebase.google.com/docs/in-app-messaging/modify-message-behavior?platform=android
Simplest way to achieve this would be to extend your MainActivity with FirebaseInAppMessagingClickListener if you know that the In-App Message will be triggered there & then create & Intent & open another activity.
Add the messageClicked function to your class:
#Override
public void messageClicked(InAppMessage inAppMessage, Action action) {
// Determine which URL the user clicked
String url = action.getActionUrl();
// Get general information about the campaign
CampaignMetadata metadata = inAppMessage.getCampaignMetadata();
// Trigger an Intent to another class
}
And register it (in your MainActivity) too:
FirebaseInAppMessaging.getInstance().addClickListener(this);
PS: In the case that you schedule your In-App Message to be triggered on a certain event, implement this code in the activity there.
I want to add some fields to popup dialog which appears when user click on verification email link sent to there email. Actually i want to extend the sign up process. So when user clicked on verify link i want to show some more fields like zip code and date of birth in popup and on clicking save those fields should save to user modal.
Any help will be highly appreciated. I am new to meteor.
I am using ian:accounts-ui-bootstrap-3 for sign up process.
Some more details if needed !
With the following package, you can replace templates :
https://github.com/aldeed/meteor-template-extension
So you create your own template, then replace the default one :
Template.emailVerifiedDialog.replaces("_justVerifiedEmailDialog")
Your dialog will be shown on every pages, you have to add the behaviour to make it visible when necessary
Template.emailVerifiedDialog.helpers({
visible: function () {
return loginButtonsSession.get('justVerifiedEmail');
}
And manage click button event :
Template.emailVerifiedDialog.events({
'click #just-verified-dismiss-button': function () {
loginButtonsSession.set('justVerifiedEmail', false);
}
});
Ok, i found solution myself.
Here it is if some one else also looking for this.
We can override email popup dialog by overriding login_buttons_dialogs.html file in /meteor-accounts-ui-bootstrap-3 folder.
I'm trying to duplicate the behaviour of the "Share on Facebook" button from Youtube. Basically, inside a Flex app I'll have a button and when I click it I want a popup that enables me to post something on the wall.
While it is possible to make a call to javascript to open the pop-up I want to be able to set the images and the text of my posting.
Do you know how I could set the images or text as a paramter to the sharer window?
Thank you!
This is fairly straightforward to do. Youtube uses the Facebook API which pops up a new window (Info on Facebook sharer API).
To do this in flex,
Create a button that onClick will call a javascript method, ExternalInterface.call("fbLink", "www.yahoo.com");
In your HTML file (most likely index.template.html) add the JavaScript method, fbLink which does the following:
function fbLink(url) {
window.popup("http://www.facebook.com/sharer.php?u=" + url, {height:440, width:620, scrollbars:true})
}
Now when a user clicks on the button they will be sharing the link "yahoo.com" with facebook account.
as I understood you asking for some help in accessing js popup in html page of facebook share button, so you should use ExternalInterface in this casa and access needed DOM node using getElementById function in your js interface.
In other case I want propose you to read another one way http://www.riaxe.com/blog/flex/publish-into-facebook-wall-from-flex/
It seems that you want to have a button on the flash application and once clicked it opens the facebook page that shares the video/image that pertains to the clicked button. What you want to do is simply create a button that on click opens a new website to facebook using their share api which has the following format:
var facebookShare:String = "http://www.facebook.com/share.php?u=' + encodedVideoLink + '&t='+ encodedVideoText";
Where the u parameter stands for the link that you wish to share, and the t parameter stands for the title of the piece that you want to share, whether it be a picture or video.
You want to add an event listener on MouseEvent.CLICK that has as its callback function a method that handles the opening of the facebook page passing the facebookShare variable as shown above. To open another page on your browser you can use this AS3 Class called URLNavigator: http://www.danishmetal.dk/project/source/com/zorked/URLNavigator.as
To sum it up, something along these lines would do:
var facebookShare:String = "http://www.facebook.com/share.php?u=' + encodedVideoLink + '&t='+ encodedVideoText";
facebookButton.addEventListener(MouseEvent.CLICK, this._goToUrl(facebookShare));
private function _goToUrl(link:String):Function {
var window:String = "_blank",
feats = "",
thisOverlay:Object = this; // to not lose scope when returning a func
return function (e:MouseEvent):void {
trace("Opening link to:"+link);
try { URLNavigator.ChangePage(link, window, feats); }
catch (e:Error) { trace("error launching "+link+" in "+window+" with feature set "+feats); }
}
}
I hope that helps. If you have questions regarding the code please let me know.
I am developing web applications with c#, Aspnet 3.5, and Ajax 2.0.
Question - I run Application_1 in ie7. I would like to programmatically start running Application_2 from Application_1 in a new tab, no matter what the client settings are.
Until now I have been opening Application_2 in a new window from Application_1 using
ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "window.open('theurl',' width=800, height=500'); ", true);
I would like to do something similar to open a new tab.
Unfortunately there is no way to control whether the window opens in a new tab or new window. This is a user setting that can't be overridden in code.
Here is Microsoft's justification if you're interested.
"Regarding script, there is no "target='_tab'" feature or any direct access to tabs from script beyond what is available with multiple windows today. We are working on balancing the default behavior for whether a window opened from script opens as in a new frame or a tab."
IEBlog
You could inform your user that by holding ctrl+shift and clicking a link will open in a new tab.
As Paul already noted, this cannot be done via any script or code.
I think it's best to let your users decide (via their individual browser settings) how they want to open the new page - in a new window or in a new tab in the same window.