Embedding Javascript and HTML into Kibana 5.x

Reading this post:


Kelvin makes a really good suggestion…. and very good inspiration. The suggestion works fine but in my case I needed it to go a step further – I needed to embed an iframe into Kibana. The iframe (and indeed any other <script> tag) was being filtered out by Angular’s sanitization protection. I needed to disable this and make sure that Angular trusts any inputted HTML and displays it as is. TO do this, we need to change the file kibana/src/core_plugins/markdown_vis/public/markdown_vis_controller.js to:


  • Line 12: we inject $sce into the controller
  • Line 15, we use the $sce.trustAsHTML function to avoid HTML sanitation

Obviously…. be very careful, this leaves you wide open to some nasty stuff like XSS, javascript attacks and so on…. make sure your kibana users are trusted


Verify if a point is Land or Water in Google Maps

Inspired by this question on StackOverflow “Verify if a point is Land or Water in Google Maps” I decided to see if the question was solvable quickly and easily. This being the API economy.. surely Google has an API to solve this question? It does… in the form of Google Elevation API. Here are the end results:

elevation api to detect land vs water
elevation api to detect land vs water


Note the hexagons pretty much stay on land even though a rectangular perimeter is defined that goes partly over water. In this case I did a quick check from within Google Maps itself and the minimum elevation on land was about 8-9m so that was my threshold. Anything below 8m is considered sea. The code is mostly derivated from google documentation and stack overflow, but here’s the full gist: