Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/test/data/banners/main.js

Issue 2379923002: Implement "appinstalled" event on Android. (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function initialize() { 5 function initialize() {
6 navigator.serviceWorker.register('service_worker.js'); 6 navigator.serviceWorker.register('service_worker.js');
7
8 window.addEventListener('appinstalled', () => {
9 window.document.title = 'Got appinstalled';
10 });
7 } 11 }
8 12
9 function addManifestLinkTag() { 13 function addManifestLinkTag() {
10 var url = window.location.href; 14 var url = window.location.href;
11 var manifestIndex = url.indexOf("?manifest="); 15 var manifestIndex = url.indexOf("?manifest=");
12 var manifestUrl = 16 var manifestUrl =
13 (manifestIndex >= 0) ? url.slice(manifestIndex + 10) : 'manifest.json'; 17 (manifestIndex >= 0) ? url.slice(manifestIndex + 10) : 'manifest.json';
14 var linkTag = document.createElement("link"); 18 var linkTag = document.createElement("link");
15 linkTag.rel = "manifest"; 19 linkTag.rel = "manifest";
16 linkTag.href = manifestUrl; 20 linkTag.href = manifestUrl;
17 document.head.append(linkTag); 21 document.head.append(linkTag);
18 } 22 }
OLDNEW
« no previous file with comments | « chrome/test/data/banners/appinstalled_test_page.html ('k') | content/public/app/mojo/content_renderer_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698