a11y icon indicating copy to clipboard operation
a11y copied to clipboard

Disable PhantomJS Redirects

Open RobLoach opened this issue 9 years ago • 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>

RobLoach avatar Mar 23 '15 17:03 RobLoach

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

sindresorhus avatar Mar 24 '15 03:03 sindresorhus

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

samccone avatar Mar 24 '15 03:03 samccone

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 avatar Mar 24 '15 03:03 samccone

@samccone I don't get what you mean as it's supposed to be implemented in the phantom script https://github.com/ariya/phantomjs/issues/10389#issuecomment-31947910

sindresorhus avatar Mar 24 '15 04:03 sindresorhus

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. :8ball:

samccone avatar Mar 24 '15 13:03 samccone