Webpage displays differently on different browsers on Mac. #11

Closed
apatil opened this Issue Sep 22, 2011 · 3 comments

3 participants

@apatil

Hi all,

On a Mac, with build 652 of Opa, the following code results in a box with 'Something' next to it on Safari and Google Chrome, but just the box with Firefox. They both seem to be getting identical HTML. Is this user error?

Thanks,
Anand

Code:

start(x) =
    Resource.styled_page("Hello.", [],
        <input id=#something>Something</><br/>
    )
server = Server.of_bundle([])
server = Server.simple_dispatch(start)

HTML received by browser:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="/_internal_/jvhapartigfviysmzqufxojlnxfnzxpt/css/dyn_css.css" xmlns="http://www.w3.org/1999/xhtml"/>

<title xmlns="http://www.w3.org/1999/xhtml">Hello.</title><link rel="icon" type="image/gif" href="/favicon.gif" xmlns="http://www.w3.org/1999/xhtml"/><script type="text/javascript">var page_server = 971796791; </script></head><body id="Body"><input id="something" xmlns="http://www.w3.org/1999/xhtml">Something</input><br xmlns="http://www.w3.org/1999/xhtml"/><script src="/_internal_/c1f0a0786224020e54ecfc835917bf62/code/all.js" type="text/javascript" xmlns="http://www.w3.org/1999/xhtml"></script>
<script type="text/javascript">//<![CDATA[

//]]>
</script>
</body></html>
@frsinot

We serve different content-types to Firefox (application/xhtml+xml) and Chrome (text/html) as a work-around to a Chrome bug (http://code.google.com/p/chromium/issues/detail?id=45440).

Your example shows that this work-around is definitely bad, as browsers behaviors are very different depending on the content-type. You can do the test without Opa, with simple files: if you name them .html, browsers will assume it's text/html, if you name them .xhtml, they will assume it's application/xhtml+xml. On these test files, Chrome and Firefox behave in the same way.

So our plan is:

  • provide a login widget that encapsulates properly the work-around;
  • remove the general work-around.

Then your code would be consistent (and not show "Something" on any browser). You may instead use the value and/or placeholder attributes, or a label tag outside of the input.

Of course it'd be great that the Chrome teams fixes the bug... (Every one is invited to "star" it, by the way.)

@apatil

Cool, thanks for looking into this.

@BourgerieQuentin
opalang member

No more workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment