开发者

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 &amp; Large">
<a href="/script.aspx?x=y&amp;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 &amp; so much, sadly not all servers actually allow this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜