This is a migrated thread and some comments may be shown as answers.

editor encodes ampersand in query string

1 Answer 156 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 31 Jul 2014, 02:05 PM
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.

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 04 Aug 2014, 08:49 AM
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.

 
Tags
Editor
Asked by
Ivan
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or