I find this doesn\'t work:
I have read this question, but I don\'t understand w
You're having issues with Cross-origin resource sharing. Read these Wikipedia CORS and MDN CORS articles.
As for your snippet,
needs to be added to the page being served and not to the page/code requesting it, which in this case would be yahoo.com. But as you don't serve yahoo.com yourself, there is no way of adding it.
However if the question was regarding your own pages and yahoo.com was just an example, you can simply set correct HTTP headers as specified in the articles, and you'd be good.