Lightbox Enable in Chrome App/Extension - google-chrome-extension

I have created my first Chrome extension/app and found out that lightboxes do not function inside the app. I created the app from the Google example kiosk app. I'm only using webview in the app and have no other customizations. It just points to a link.
I want to use the app as an auto-launch Kiosk app on a Chromebox. Via this website I found that 'alert' and 'confirm' are a disabled web feature on chrome web apps.
I am wondering if it is possible to enable alert and confirm in the Chrome app so that lightboxes will work when interacting with a website.
Thanks in advance.

Yes you can definitely call alert box inside a chrome extension, just like you would in a normal javasript file as stated in this thread.
chrome.browserAction.onClicked.addListener(
alert("Im an alert box triggered by Chrome Extension")
);
The link you provided suggests that you can create a custom popup/lightbox as a workaround. There's a complete tutorial here.
Happy coding! :)

Related

How to build web application that run in WeChat in app browsers?

I am trying to build a simple web application, which capture users photo and sent it my custom server there by connected to some other business use-case. My web page uses HTML's file input control to launch native camera or gallery pick up option.
var input = document.createElement('input');
input.setAttribute('accept', 'image/*');
input.setAttribute('capture', 'camera');
input.setAttribute('type', 'file');
input.click();
This web app, I placed in local webserver with a name "PhotoLocker" and testing with url like
https://localhost(ipaddress to access via mobile browser)/PhotoLocker/index.html
This link is working fine both on desktop and mobile chrome browsers and am able to debug any issues. Where as same link, I try to access from WeChat browser (just opening above link from chat window), it is not at all opening my application in WeChat in app browser.
After googling, I found that https URL scheme is not supported by WeChat. is it True? When I paste the same app url as weixin://ipaddress/PhotoLocker/index.html, I am able to see my web app home page but it is not working as expected.
My Question is - how to debug my webpage opened in WeChat browser? Do I need a official WeChat Dev account even to develop and test sample apps?
Additional Info :
I am able to debug webpage from WeChat web devloper tool as mentioned in below link. But, unable to debug mobile wechat page in this tool. It is always opening chrome dev tools.
https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140&t=0.06697335132505233#1
I am a frontend developer in China, Chinese. Forgive my English for any mistake, misunderstanding I could make. Some links (dev docs mostly) below contain sites complete in Chinese, because I can not find corresponding English ones for now.
how to debug my webpage opened in WeChat browser?
Tencent provide an IDE for developing regular web interface and WeChat-mini-program, with which developer can directly interact with:
JSSDK (basically a special weixin
Object lives only in in-WeChat-browser);
API provided in WeChat-mini-program.
If you download that IDE:
First it will ask you is to use you WeChat to scan the QRCode, then confirm login with your WeChat account;
Next it will show up two square button (image below), left one is for WeChat-mini-program, the right one is for you to testing regular web page.
Click the right blue one, then you can find your way out, it's just something built top on project Blink.
As you can see the part of debugging regular webpage in WeChat IDE is no more than a simulator (in the WeChat-mini-program part, developer can write code directly in it), and in my experience it does have bugs, you will still need to test code in real machine.
For that Tencent provide another tool called vConsole, tutorials here, with it you can do following things directly in in-WeChat-browsers:
View console logs;
View network requests;
View document elements;
View Cookies and localStorages;
Execute JS command manually
and so on
Do I need a official WeChat Dev account even to develop and test sample apps?
Depends.
You may know the Official Account inside WeChat, with webpages directly opened in any context inside in-WeChat-browser, it will have the ability to interact the weixin Object, or have some API like login with WeChat, pay with WeChat Pay:
API like close current in-WeChat-browser, hide-share-button will not required anything special, you don't need to register any Official Account;
But if you want yo do the Pay, Login thing, you need an Official Account and pay for the ability every year (not sure about this outside China).
The localhost problem you faced
I don't have my working machine with me now so I can not test. Regularly I can proxy localhost with Charles then debugging in WeChat, but never do the https, I will try it later.
All the information got regarding how to debug webpage opened in wechat browser redirects to how to see log or ajax/netwrok calls analysis.
Even with WeChat web devloper tool as mentioned in below link, I am unable to debug mobile wechat page in this tool. It is always opening chrome dev tools.
https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140&t=0.06697335132505233#1.
Hence further analyzed remote mobile webpage debugging and found that there is no way to put break points, watch, expressions and all just like in chrome dev tools is not possible.
As a work around - you are able to debug code, when you simulate page in dev tools but no way to debug webpage in mobile device.
Same webpage when tried to do remote debugging as per WeChat web devloper tool documentation. here we can only see console logs and network calls.

Enabling Adsense Management API [duplicate]

I am trying to enable the adsense management api from the google developers console. I have created a project and under APIs and auth I go to APIs and try to turn on AdSense Management API, but when I click it it just shows a toast notification saying "Error Enabling Adsense Management API". I really need this to work. So help is appreciated.
Thanks,
Sai
I had the same problem. I disabled my AdBlocker. Then it worked just fine!
Have you tried using a different browser or going back to the old version of the console? I had a similar issue because the browser blocked the Terms of Service agreement page.
I had the same problem. Disable AdBlock plugin and it will work!
Open a new incognito window and open the console url "https://console.developers.google.com/" there. After that, activate the AdSense Management API.

Cannot set/change default icon for a Chrome webapp (created using Apps Script) in Chrome desktop launcher

I wrote a simple Google Apps script and published it in the Chrome Web Store as an app (I guess "hosted" app. You can find the link here: http://bit.ly/1JTiKLC). I followed the instructions mentioned here:
https://developers.google.com/apps-script/guides/distribute-web-app
I specified all the required items in the checklist, AFAIK, including icons of the required size. The item is listed and I can download it. However, when it is added in the Chrome desktop launcher, it has the default "apps script" blue icon:
I want to change this but can't find any way to do so. The link above specifies that there is a way to do this for a new tab page (sec. Updating a web app's icon on the New Tab Page). First of all, I cannot see any link that says "specify an alternative image" anywhere as they say. Could someone elaborate on this. Secondly, is there a similar way to change the launcher icon for apps script webapps?
Ok, I found it. Here's the info for someone else who may have the same question: The link appears in the window just after you click "Publish>Register in Chrome Web Store..." in the apps script editor itself. It's not there in the developer dashboard. You can host the image publicly on any site which provides direct links, like imgur.
This will change the icon in the Chrome new page tab (or in "chrome://apps/") as well as the desktop launcher. Cheers :)

chromecast on chrome packaged app

I would like to add the ability to cast my chrome packaged app to a google chromecast device.
So far google states that all you have to do is add
to your page and the API will inject itself.
For me that doesn't happen. No code is injected.
Am I doing something wrong?
There doesn't seem to be a demo showing this type of capability.
EDIT:
I just wanted to clarify a bit. All that I would like to do is display my app to a screen.
I have no media. I simply want to display it exactly as the chrome extension in the chrome browser would.Therefore I would follow the directions for a sender only. The app is packaged so it is running only CSS/JS/HTML5 code. The app is designed to run offline.
Steps I've taken to cast:
1. I've added the extra bit to the HTML line:
2. I've followed the whitelisting, to the best of my understanding, by adding my "website address" to the chrome extension. So I've added the only two address that should matter.
127.0.0.1
192.168.1.106
There is a good chance Content Security Policy is blocking the implementation of the cast API being injected. I see that you've filed Issue 287254: Google cast (chromecast) ability for packaged apps, and suspect we will need to wait for it to be implemented in a packaged apps compliant way.
You must whitelist your device and your Chrome app. See here for more details:
https://developers.google.com/cast/whitelisting#whitelist-chrome

How to launch a chrome packaged app using a URL scheme

I have a chrome packaged app that I update form time to time - when I'm creating an update I want to send email to subscribed customers with a link the that extension -that will launch it.
Anyone knows if there is a chrome url scheme i can use?
Currently this is not possible, but there is an API proposal and an implementation being developed for a chrome-app://appid URL schema that would do pretty much what you describe.
Follow the status here
I also want to be able to do this. It seems that one possible solution is to install both an extension and a packaged app, and have the extension register a context menu that then communicates with the app, or something similar.

Resources