'Test for JavaScript redirects, these are some common redirects:
location.href = \'../htmljavascript.htm\';
window.location = "http://www.w3af.com/"
window.location.href="http://www.w3af.com/";
location.replace(\'http://www.w3af.com/\');'

def _javascript_redirect(self, response):

    res = self._script_re.search(response.get_body())
    if res:
        url_group_re = ('(%s)' % '|'.join(self.TEST_URLS))
        for script_code in res.groups():
            script_code = script_code.split('\n')
            code = []
            for i in script_code:
                code.extend(i.split(';'))
            for line in code:
                if re.search(('(window\\.location|location\\.).*' + url_group_re), line):
                    return True
    return False
