add fallback if document.currentScript is not available (e.g. with Webkitties)

Fixes #693
Done.