How do JavaScript link actions work?