2

Would it be possible to create a virtual web browser, inside your existing web browser, using canvas, to achieve near pixel perfect representation of websites across all browsers?

3 Answers 3

4

Take a look at http://html2canvas.hertzen.com/ - It's a HTML renderer using a Canvas element. There are a few limitations (some CSS3 properties don't work) and you can only do static images with it. But it's still very cool.

Also it's still going to be browser-specific in terms of exact positioning of elements.

Sign up to request clarification or add additional context in comments.

2 Comments

Making a new canvas, 300x300, then adding a red square, (50,50)(100,100) will surely display exactly the same on all browsers that implement the canvas?
Mostly, Yes. But the project I posted above depends (as far as I know) depends on the browsers HTML parsing to understand the document that it is to render. Also while something as simple as a red square would certainly render the same across browsers, other more complex images involving paths and blending would not be guaranteed to be the same pixel-for-pixel across browsers.
2

Theoretically: Yea, maybe... no.

Practically: Hell no.

You can't play flash / silverlight / java applets on canvas. Also, you'd have to:

  • Manually parse the DOM,
  • Apply CSS,
  • Execute JS,
  • Render everything,
  • Make input elements,
    • dropdown menu's,
    • hyperlinks,
    • mouseovers,
    • and all that kind of interaction work,
  • And whatever else I've forgotten.
  • Like proper Anti-Aliasing

3 Comments

Seriously, you're using flash/silverlight/java app as an argument against canvas? Canvas was made to remove the need of them. You could use the browser to process most of it, you would just need to render it. Inputs and all aren't that hard surprisingly.
@user1277170 that's not what he was saying. He was saying that if you tried to use a canvas to render the page, any flash/SL on the page couldn't be rendered.
@user1277170: Canvas was made to replace them, yes. But it's not nearly there yet. I was just listing things that can't be done in canvas.
0

Only with tremendous difficulty.

Why not just use <iframe>?

1 Comment

iframe uses the same rendering as the browser. You must have missed the "to achieve near pixel perfect representation of websites across all browsers" bit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.