Ampersand in Querystring is breaking page render on Blackberry
Strangely enough, anytime I have an &
in an HREF to indicate querystring parameters I receive the following error on the Blackberry Curve:
Error encountered durin开发者_Go百科g XML parse: expecting ';'.
Is there any way to get it to accept & in querystrings? Other mobile browsers don't like the ;
to separate querystring parameters.
NOTE: I am using ASP.NET 2.0 if that makes a difference.
Blackberry is (for once) correct. Your code is not valid XML (or HTML), as the Validator will confirm.
Is there any way to get it to accept & in querystrings?
Yes, the same way you get an ampersand into any attribute value or text content. HTML-encode it.
Fish & Chips
<div title="Little & Large">
<a href="/script.aspx?x=y&a=b">
Other mobile browsers don't like the ; to separate querystring parameters.
That's a server-side issue rather than a browser issue. Whilst the HTML4 spec recommends that servers accept ;
as an alternative separator character to &
, precisely to avoid the annoyance of having to write &
so much, sadly not all servers actually allow this.
精彩评论