Handle pages with no scripts tags

Added checks and fallbacks for pages with no script tags.
Fixes #188.