en.javascript.info/2-ui/2-events/04-default-browser-action/2-catch-link-navigation/solution.md
Ilya Kantor ab9ab64bd5 up
2017-03-21 14:41:49 +03:00

5 lines
465 B
Markdown

That's a great use of the event delegation pattern.
In real life instead of asking we can send a "logging" request to the server that saves the information about where the visitor left. Or we can load the content and show it right in the page (if allowable).
All we need is to catch the `contents.onclick` and use `confirm` to ask the user. A good idea would be to use `link.getAttribute('href')` instead of `link.href` for the URL. See the solution for details.