Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 동적dom
- c#
- cookie
- SQL
- di
- ADO.NET
- IT 관련
- Excel
- JavaScript
- ASP.NET
- jQuery
- 메소드
- 구글
- asp.net mvc
- delegate
- LINQ
- 제네릭
- angularJS
- Generic
- XML
- 클래스
- It
- 디자인패턴
- MSSQL
- csv
- IT관련
- mvc
- iframe
- Today
- 386
- Total
- 1,439,327
심재운 블로그
chrome push 의 알림 클릭시 특정 url 이동시키기 본문
chrome 에 push 를 전송하고나서 알림이 뜨면 이를 클릭할 경우 특정 도메인 주소로 이동하는 방법을 구현한 스크립트입니다.
self.addEventListener('notificationclick', function(event) {
let url = 'https://example.com/some-path/';
event.notification.close(); // Android needs explicit close.
event.waitUntil(
clients.matchAll({type: 'window'}).then( windowClients => {
// Check if there is already a window/tab open with the target URL
for (var i = 0; i < windowClients.length; i++) {
var client = windowClients[i];
// If so, just focus it.
if (client.url === url && 'focus' in client) {
return client.focus();
}
}
// If not, then open the target URL in a new window/tab.
if (clients.openWindow) {
return clients.openWindow(url);
}
})
);
});
https://stackoverflow.com/a/39457287
'프로그래밍 > JavaScript' 카테고리의 다른 글
모바일 웹에서 카카오맵 앱 호출하여 띄울려고 할 경우 (0) | 2019.10.11 |
---|---|
chrome push 의 알림 클릭시 특정 url 이동시키기 (0) | 2019.09.10 |
clusterize.js Tiny vanilla Js 플러그인, 대용량 data를 쉽게 table 형태로 보여줌. (0) | 2019.09.02 |
javascript 로 page 별 timeout 설정하여 로그아웃 강제시키기 (0) | 2019.08.30 |
javascript 숫자 8자리 형식을 년-월-일 형식으로 보이기 (0) | 2019.05.10 |
javascript 로 숫자에 소수점 여부 확인하기 (0) | 2019.01.07 |
0 Comments