Skip to content

Instantly share code, notes, and snippets.

@me7
Created Feb 8, 2017
Embed
What would you like to do?
Inject mithril to webpage
//press F12 to open chrome dev tools
//then add mithril to header
var mt = document.createElement('script');
mt.src = "https://unpkg.com/mithril/mithril.js";
document.getElementsByTagName('head')[0].appendChild(mt);
//test render
m.render(document.body,"Hello");
//let create link and click
m.render(document.body,m("a#link",{href:"https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/02/1454335918es6-arrow-functions-new-fat-and-concise-syntax-in-js05-no-parameters.png"},"click"))
var l = document.getElementById("link")
l.click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment