I know this is an old post, with a lot of changes since 2017, but I have found that I can close my current tab/window with the following now in 2019:
onClick=”javascript:window.close(”,’_parent’,”);”
** Update **
Since posting the answer the latest versions of browsers prevent the command from working. I’ll leave the answer visible but note it ONLY works on older browser versions.
Most browsers prevent you from closing windows with javascript that were not opened with window.open(“https://example_url.com”) however, it is still possible to close the current window using the following command:
window.open(”,’_self’).close()
This loads a blank url (the first argument) in the current window (the second argument) and then instantaneously closes the window. This works because when close() is called, the current window has been opened by javascript.