Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[discuss]about headless-chrome render failed. #2

Closed
Raxxor opened this issue Jun 19, 2017 · 6 comments
Closed

[discuss]about headless-chrome render failed. #2

Raxxor opened this issue Jun 19, 2017 · 6 comments

Comments

@Raxxor
Copy link

Raxxor commented Jun 19, 2017

I tried some headless-chrome render solution inlcuding koa-seo, and always failed when render "http://www.chenggua.com" or "m.chenggua.com". It is always successful when render "http://vue-prerender.deboy.cn/titleFromRouterDefine". So i guess is there any conflict or other problems?

BTW, phantomjs render "www.chenggua.com" is OK, with some tiny errors about codec.
This issue is raised only for discussion, about headless-chrome render capacity and robust.

@gwuhaolin
Copy link
Owner

is there any error log out by koa-seo?

@Raxxor
Copy link
Author

Raxxor commented Jun 20, 2017

Sorry about my mistake, since we do not use KOA directly, so I test chrome-render under your projects, which Koa based on it. There is no obviously error reported.

ChromeRender.new({}).then((chromeRender)=>{
htmlString = chromeRender.render({
// url: 'http://vue-prerender.deboy.cn/titleFromRouterDefine',
url:'http://www.chenggua.com',
});

console.log(htmlString);

With compared these, result shows vue-prerender.deboy.cn rendered successfully while www.chenggua.com outputs just like "curl" result. It was rendered failed with other headless-chrome solution either. Seems there might be some confilct or capacity problems.

@gwuhaolin
Copy link
Owner

see chrome-render'doc

useReady: boolean whether use window.chromeRenderReady() to notify chrome-render page has ready. default is false chrome-render use domContentEventFired as page has ready.

www.chenggua.com render data after domContentEventFired and chrome-render use domContentEventFired default. You should use useReady: true and call window.chromeRenderReady() in you web page after data has rended out.

@Raxxor
Copy link
Author

Raxxor commented Jun 20, 2017

Thanks for your kindly help, it was rendered successfully after set useReady:true and add window.chromeRenderReady().

BTW, is there any solution without add window.chromeRenderReady() in html pages? If we want to setup a seo-render server, without original html modification.

@gwuhaolin
Copy link
Owner

without add window.chromeRenderReady() can not guarantee correctness in some complex scenes as I don't know when is your page's data is ready, so I give this power to user.

@gwuhaolin
Copy link
Owner

notice window.chromeRenderReady() has been change to window.isPageReady = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants