Stricter parsing for external links in JavaScript

Bug: 49850
Change-Id: If7337cb1a9b729c511adb32d8a2326ea17a8160c
Merge "Stricter parsing for external links in JavaScript"