Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Teach me to write 3rd party java script please?
1 point by kirillzubovsky on Sept 11, 2019 | hide | past | favorite | 2 comments
Could someone please help me understand everything I would want to know in order to create third-party JS widget, like twitter embeds or facebook ads, in the shortest amount of time?

I am okay getting 80% of the value in 20% of the time, for now, and would love to know of any guides, pitfalls, and best practices for writing such widgets.

Basically, I will consume anything you're willing to throw my way so I could get from 0 to 1 asap. Appreciate it!



There is no magic in these widgets. People have to add certain snippets, mostly a JavaScript file from some CDN and some basic HTML tags where these widgets shall appear, and everything else is done by the JavaScript.

In former days, people used iframes, this was even easier because the iframe could basically show any website with its own styling, scripting, etc.

If you want to get hands dirty, then skip any framework, learn modern ECMAscript, vanilla Dom and try out to modify a well known element in the target page from your script.


From what I understand the scripts usually find an anchor in the page, then load some iframe/html content and update the anchor with new data. That in itself doesn't seem too bad, but ... it can't be that easy. I mean, each one of those widgets usually is 100s lines of code. I feel like I am missing something very important.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: