Added check for cross origin call

Default to location.href if the call is to cross origin url. Fixes #449