Hank The Developer

Hank's personal site. Browser Extension, JavaScript, HTML5 and so on

I’ve created a Google Script APP to help someone export Gmail data to Google SpreadSheet.

It works well when I was testing. But after I publish it as web app, and other users got an error which says

[Error] ScriptError: Document DOCUMENT_ID is missing (perhaps it was deleted?).

And no authorize permission form popups up.  I did not get any useful answer in Google.

After several tests I found I made a stupid mistake.

When publishing the Google Script as web app or other types of APP. There are several options need to take carefully.

Execute the app as:

should set as “User accessing the web app“. (The default value is  Me(myself email)).

With this option, when user first use your app, the authorize permission form will popup and ask user to allow your app access their Google APP.

And no more Document is missing error.

Also don’t forget to chose Anyone in the Who has access to the app option.




March 5th, 2017

Posted In: Program

Leave a Comment


Here is how to debug native messageing: enable logging.

By adding a flag, it can open Chrome logging window when starting Chrome.

For Windows, you just need to right click on the Chrome icon in your installation folder / shortcut / taskbar —— Properties  —— add this line behind the target string:

--enable-logging --v=1

A logging window will start with the Chrome. There the native messaging stuff will be print out.

March 1st, 2017

Posted In: Program

Leave a Comment

In former version, users can install Firefox addon easily by drag and drop the addon file (.xpi file)  into Firefox to install and use it.

But now, user can not do this by default. User can only install addon from AMO (https://addon.mozilla.org). If you download an addon from other website or like me develop addon self. when you drag and drop the file into Firefox. it will be disabled and can not be enable. It says : ADDON NAME could not be verified for use in Firefox and has been disabled.  like this(I’m using Nightly Firefox):

Unnamed QQ Screenshot20151104000045

well, it’s easy to pass this by these steps.

1: Navigate to about:config in Firefox (input about:config into Firefox’s address bar and hit Enter)

2: You might see a warning screen warning the action is not safe. Just hit the blue button  I’ll be careful, I promise .

3:You will see a long list. Input the keywords xpinstall  in the search bar.

4: Find the xpinstall.signatures.required, it’s value should be true now. click this line, change the value to false.


5: You are done, you will see that your addon enabled and working:)


November 3rd, 2015

Posted In: Program, Uncategorized

Tags: , ,

Leave a Comment

Well, Google said, there are more great services like Github and Bitbucket, so Google code is not needed any more,  it will shut down Google code service soon. And there is some tools to export your projects to other platform like Github, Bitbucket or SourceForge.

The shut down schedule is:

  • March 12, 2015 – New project creation disabled.
  • August 24, 2015 – The site goes read-only. You can still checkout/view project source, issues, and wikis.
  • January 25, 2016 – The project hosting service is closed. You will be able to download a tarball of project source, issues, and wikis. These tarballs will be available throughout the rest of 2016.

At the same time, Google says it will continue serve some projects like Android and Chrome so that user can continue git them. And also will continue maintaining  mirrors for projects like Eclipse kenel.

Google also gives an export tool to export your project to Github.  And also here is another tool to export any of your projects to Github/Bitbucket/SourceForge.

SourceForge also supplies an import tool to import Google code project.


March 13th, 2015

Posted In: Internet, Program, Uncategorized

Tags: , ,

Leave a Comment

Well, gmail.js is a very nice script that if you want to work with Gmail (developing browser extensions for Gmail).

The author says that gmail.js is designed for Chrome extension development. There is also many examples about how to use it in Chrome extension. But, how to use it in Firefox addon development?

If you inject it directly in the page, you will got an error: GLOBAL is not defined.

it is because the gmail.js uses 2 variables in the Gmail page, GLOBAL  and also VIEW_DATA. If you inject it directly by pageMode, it can not access any page script.

So you need to modify the gmail.js, in line 6 and 7 (if line number is different, just search it ). By using unsafeWindow , you can access the Gmail page variable:

api.tracker.globals =GLOBALS;

api.tracker.globals = unsafeWindow.GLOBALS;


api.tracker.view_data = typeof VIEW_DATA !== "undefined" ? VIEW_DATA : [];


api.tracker.view_data = typeof unsafeWindow.VIEW_DATA !== "undefined" ? unsafeWindow.VIEW_DATA : [];

Then you can use the gmail.js without error.

Actually in Chrome extension, you can not inject gmail.js with content script decoration in manifest.json directly, because in that way  you can not access GLOBAL too.

You need to use another content script to inject it  with add <script> block in the page, here  is the code snap

window.onload = function () {

    //inject jQuery
    var jq = document.createElement('script');
    jq.src = chrome.extension.getURL("lib/jquery-2.1.1.min.js");

    //inject gmail.js
    var sm = document.createElement('script');
    sm.src = chrome.extension.getURL("lib/gmail.js");
    //inject the script that actual do your things 
    var ct = document.createElement('script');
    ct.src = chrome.extension.getURL("content.js");

Then declare this file as content script in the manifest.json. and also declare all 3 scripts in web_accessible_resources.

December 6th, 2014

Posted In: Program, Uncategorized

Tags: , , ,


说起来惭愧,作为一名Google开发者,这么重要一个API 应该很早以前就会用的。但是因为其他工作一直忙,这个目标就没有实现…




July 14th, 2014

Posted In: Program, Uncategorized


One Comment

From  version 35,  Chrome will disable extensions that not come from Chrome web store. It do makes your Chrome safer,  But it also bring some problems for some users.  That is, If you are using a extension that you don’t want to upload it to the Chrome web store, you can not use it anymore. This extension will be disabled and can not be enabled:

Well, here is how to re-enable extensions like this (not from Chrome Web Store):

  1. navigate to chrome://extensions page. delete the disabled extension by clicking the trash icon
  2. find your extension file that ends with .crx or .zip extension.
  3. right click on the file, use 7-zip software(or any other extract tool) with “Extract to…” command to extract the extension
  4. drag and drop the extracted FOLDER to the chrome://extensions page.
  5. Confirm the permissions  confirmation information
  6. You are done.

Here is how to do it :


You can also manage your extensions with my Extension
One Click Extension Manager -No Ads

June 18th, 2014

Posted In: Program, Release, Uncategorized

Tags: ,