editor encodes ampersand in query string

2 posts, 0 answers
  1. Ivan
    Ivan avatar
    16 posts
    Member since:
    Oct 2011

    Posted 31 Jul 2014 Link to this post

    Hello,

    1. open a hyper link manager and insert the following link: http://google.com?a=1&b=2
    2. click ok and check the resulted HTML in the editor (html view)

    ampersand in the href attribute is encoded:

    Is there a way to make it not encode query string separator.
  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 04 Aug 2014 Link to this post

    Hello Ivan,

    Indeed the & character is converted to entity, but this happens due to browser logic and it will continue be encountered even with disabled content filters (ContentFilters="None").

    Even though this seems as it would break the URL, the browser manages to handle the situation as a proper URL query string.

    You can see with the following example markup, that simple anchor elements outside the RadEditor, set with entity and with proper URL & character are leading to the sane href value. Also, you can test in the editor the set links using the middle mouse button to open the targets and verify manually the links inserted. You will see that even with entity in the href, the proper  query string is precessed. \

    Example:
    <telerik:RadEditor runat="server" ID="RadEditor1" ContentFilters="None">
        <Content>
            <a class="targeted" href="http://google.com?a=1&b=2">Google link</a>
            <br/>
            <br/>
            <a class="targeted" href="?a=1&b=2">Open with queries</a>
        </Content>
    </telerik:RadEditor>
    <br />
    <br />
     
    <a class="targeted" href="http://google.com?a=1&;b=2">Google link 1</a>
    <br />
    <br />
    <a class="targeted" href="http://google.com?a=1&b=2">Google link 2</a>
     
    <script>
        function pageLoad() {
            var anchors = $telerik.$("a.targeted");
     
            for (var i = 0; i < anchors.length; i++) {
                alert(anchors[i].href);
            }
        }
    </script>


    Regards,
    Ianko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top