Version of PhantomJS: Version 1.3.0 "Water Lily".
What steps will reproduce the problem? 1. I run from console:
DISPLAY=:0 timeout 25 /root/phantomjs/bin/phantomjs --ignore-ssl-errors=yes /root/phantomjs/rasterize202x152.js www.chow-chow.hu /var/thumbnails/thumbfile.jpg or: DISPLAY=:0 timeout 25 /root/phantomjs/bin/phantomjs --ignore-ssl-errors=yes /root/phantomjs/rasterize202x152.js http://hfv-speyer.de /var/thumbnails/thumbfile.jpg
- /root/phantomjs/rasterize202x152.js listing: var page = new WebPage(), address, output, size, rc=0; page.settings.userAgent = 'Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/7.0';
if (phantom.args.length < 2 || phantom.args.length > 3) { console.log('Usage: rasterize.js URL filename'); phantom.exit(); } else { address = phantom.args[0]; output = phantom.args[1]; page.viewportSize = { width: 1024, height: 768 } page.open(address, function (status) { if (status == 'fail') { console.log('Unable to load the address! ' + address); phantom.exit(); console.log('Unable to load the address! ' + address); } else { window.setTimeout(function () { page.clipRect = { top: 0, left: 0, width: 990, height: 745 }; page.render(output); console.log(status); phantom.exit(); }, 200); }
});
}
What is the expected output? What do you see instead? I expected to get JPEG thumbnail in /var/thumbnails/thumbfile.jpg but no file creates. For chow-chow.hu I get "success" message, and no error is shown. For hfv-speyer.de I get "Unable to load the address!" error message.
Which operating system are you using? Debian GNU/Linux 2.6.32-5-686
Did you use binary PhantomJS or did you compile it from source? Compiled from the source.
Please provide any additional information below:
It seems that PhantomJS can`t follow redirects like that on this websites: http://www.chow-chow.hu ( redirects to http://www.chow-chow.hu/start.php ) and http://hfv-speyer.de (redirects to http://www.hfv-speyer.de/js-start.htm) Many other websites are rendering well the same way at my server.
Great thanks for developers for such awesome project! I really appreciate your work.
Comment #1
Posted on Feb 20, 2012 by Quick LionOne more example of this issue is: http://snowplay.com which redirects to http://snowplay.com/cms/
Comment #2
Posted on Jul 3, 2012 by Happy LionComment deleted
Comment #3
Posted on Sep 3, 2012 by Happy LionHi,
I'm having the same issue with version 1.6.1.
Thanks, Ryan
Comment #4
Posted on Nov 28, 2012 by Helpful CatI am having the same issue with v 1.6.1.
I'm trying http://osc3.ezimobile.biz which redirects to http://osc3.ezimobile.biz/catalog
Here is the index.html file from that server: http://osc3.ezimobile.biz/catalog/" />
Does anyone have any workarounds for this?
Comment #5
Posted on Dec 3, 2012 by Helpful CatComment deleted
Comment #6
Posted on Jan 11, 2013 by Helpful ElephantAll of the examples provided here contain redirects in HTML (something like ) or in Javascript (window.self.location.replace('index.php' );). (I've yet to see PhantomJS fail to follow an HTTP redirect via the Location response header.) As much as I find this frustrating in my own projects, I think that PhantomJS is working as it ought. That said, having some sort of optional timeout that waits a configurable amount of time for any location changes before firing the page.open callback would save a lot of repetitive userland code.
Comment #7
Posted on Feb 26, 2013 by Grumpy BearI am facing a similar issue where the redirect is done using location.replace. Though it is kinda strange that it generates the image with phantomjs1.5.1 whereas it does not with v1.8.1
Comment #8
Posted on Mar 15, 2013 by Grumpy OxI am facing a similar issue, lots of sites redirect (301) but phantomjs fails to notice.
6 - why this is an intended feature? Seems this significantly limits the use of PhantomJS as a gui-less browser.
Comment #9
Posted on Mar 15, 2013 by Grumpy OxJust a small addenum: pjs2 netsniff.js http://www.forbes.com FAIL to load the address
This is not an expected output, of course.
Comment #10
Posted on Mar 15, 2013 by Grumpy OxPerhaps a fix would be to detect whether the first accessed document results with a redirection (302/301) and then just assume this is the main document we wanted to access from the start and proceed?
Comment #11
Posted on Mar 16, 2013 by Happy HorseClosing. This issue has been moved to GitHub: https://github.com/ariya/phantomjs/issues/10389
Status: Migrated
Labels:
Type-Defect
Priority-Medium