fix issue #4

determine url.referer before load any scripts