Should the browser encode a user URI before launching the application?

I have an application that runs on a custom URI that looks like myapp://whatever/something

There is an HTML page that has a href link like this -> myapp://whatever/?x=abc;y=pqr; When it is clicked in chrome, myapp gets the URL myapp://whatever/?x=abc%3By%3Dpqr%3B, the URL gets the encoding. However, when I click on the same link in the default Internet browser, the encoding fails. It gets the original url →myapp://whatever/?x=abc;y=pqr;

What is the correct behavior?

I tried this with Chrome 38.0.2125.114 on Android 4.4.3. Also, I think that earlier versions of Chrome did not do this, but are not so sure.

+2
source share
1 answer

The handling of semicolons in URLs is not completely consistent, so your best approach is to avoid your URL correctly and unambiguously.

If you intend to set one request parameter xto a value abc;y=pqr;, then the escaped form is correct:

?x=abc%3By%3Dpqr%3B

However, if you plan on individual parameters, then it &will be the best choice for interaction. If you want to indicate xhow abcand yhow pqr, then you must indicate this as:

?x=abc&y=pqr

As you have seen, browser behavior is not predictable with undefined semicolons, so avoid them.

+2
source

All Articles