addyosmani/a11y

Disable PhantomJS Redirects

RobLoach opened this issue · 5 comments

Using something like the following will stall and error out PhantomJS, due to the URL redirect in the HTML.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="refresh" content="1;url=http://example.com">
    <link rel="canonical" href="http://example.com">
    <script>
        window.location.replace('http://example.com');
    </script>
</head>
<body>
    <p>This page has been moved <a href="http://example.com">here</a>.</p>
</body>
</html>

It should follow the redirect, not disable it, right?

yeah seems like a default follow of the redirect would make sense since just like curl -L

alas
https://github.com/addyosmani/a11y/blob/master/index.js#L33

since we are execing the phantom binary it kinda limits our options here, imho it would be nice to use the npm wrapper to then be smart about following redirects.

thoughts?

@samccone I don't get what you mean as it's supposed to be implemented in the phantom script ariya/phantomjs#10389 (comment)

I see what you mean @sindresorhus it "should" work, I was just pointing out that we could be smart about it within phantom's onNavigationRequested and perhaps be smarter than the lib at handling cases like above. 🎱