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

originalPath, originalAttribute inserted into javascript code in IE

9 Answers 94 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Amey
Top achievements
Rank 1
Amey asked on 22 Jul 2010, 03:32 PM
Here's the sample code I'm using:

<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p.js"></script>
<noscript>
<a href="http://polldaddy.com/poll/">Test</a><span style="font-size:9px;">
<a href="http://polldaddy.com/features-surveys/">test2</a></span>
</noscript>

When I add the code to the HTML mode, then switch to the Design Mode, then switch back to the HTML mode,
1) the <script> tags disappear, and
2) the <noscript> tags have inserted "originalAttribute=X" and "originalPath=Y" into the anchor tags.

In IE only (I'm using IE 8), both 1 and 2 can be reproduced by pasting the sample code above into the Editor Demo: http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx.

Thanks.

9 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 27 Jul 2010, 08:44 AM
Hi Christian,

Straight to the points:

1) If you would like to keep the <script> tags in the RadEditor's content area, you should disable the RemoveScripts filter of RadEditor, e.g.

RadEditor1.DisableFilter(EditorFilters.RemoveScripts)

This filter is enabled by default strips the <script> tags to reduce the possibility of cross-site scripting and other script-related problems.

2) We are aware of the <noscript> problem. We will add a check in the ConvertToXhtml filter for this case and this will fix the problem for the next Q2 SP1 2010 release.

You can fix the problem in the current build by implementing a custom DOM content filter and execute the following two lines of code in it:

nodeContent = nodeContent.replace(/\soriginalAttribute="[^"]+"/gi, "");
nodeContent = nodeContent.replace(/\soriginalPath="[^"]+"/gi, "");


Here is the whole content filter:

<telerik:radeditor runat="server"ID="RadEditor1"SkinID="DefaultSetOfTools"OnClientLoad="OnClientLoad">
</telerik:radeditor>
<script type="text/javascript">
    functionOnClientLoad(editor, args) {
        editor.get_filtersManager().add(newMyFilter());
    }
    MyFilter = function() {
        MyFilter.initializeBase(this);
        this.set_isDom(false);
        this.set_enabled(true);
        this.set_name("RadEditor filter");
        this.set_description("RadEditor filter description");
    }
    MyFilter.prototype =
    {
        getHtmlContent: function(content) {
            varnodeContent = content;
            //Make changes to the content and return it
            nodeContent = nodeContent.replace(/\soriginalAttribute="[^"]+"/gi, "");
            nodeContent = nodeContent.replace(/\soriginalPath="[^"]+"/gi, "");
            returnnodeContent;
        }
    }
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);
</script>

Kind regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Amey
Top achievements
Rank 1
answered on 27 Jul 2010, 08:10 PM
Hello,

#1 still doesn't work for us.  our settings are

EncodeScripts=true

MakeUrlsAbsolute=true

ConvertToXhtml=true


with these all set to true, any javascript pasted into IE gets stripped out.  it seems to be the "MakeUrlsAbsolute=true" that is the culprit.

you can replicate this one your demo editor:
http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx


with this code:
<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p.js" originalAttribute="src" originalPath="http://static.polldaddy.com/p.js"></script> <noscript>
<a href="http://polldaddy.com/poll/" originalAttribute="href" originalPath="http://polldaddy.com/poll/">Test</a><span style="font-size:9px;">
<a href="http://polldaddy.com/features-surveys/" originalAttribute="href" originalPath="http://polldaddy.com/features-surveys/">test2</a></span>
</noscript>
0
Rumen
Telerik team
answered on 28 Jul 2010, 08:54 AM
Hi Christian,

You are absolutely right that the problem appears only when the MakeUrlsAbsolute filter is enabled. I logged the problem with high priority and we will try to fix it as early as possible. I also updated your Telerik points for reporting this problem.

Currently the only workaround is to put some content before the script tag, for example a simple &nbsp; will do the trick.

The issue is logged in our PITS system with ID: 2871.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Amey
Top achievements
Rank 1
answered on 13 Sep 2010, 07:42 PM
So this was suppsed to be fixed in the latest version of the RadEditor

It's not longer removing the <script> tags so that's a good start, but it still injects this originalPath/originalAttribute nonsense"

so this:
<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p.js"></script>
<noscript>
<a href="http://polldaddy.com/poll/">Test</a><span style="font-size:9px;">
<a href="http://polldaddy.com/features-surveys/">test2</a></span>
</noscript>

becomes:

<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p.js" originalAttribute="src" originalPath="http://static.polldaddy.com/p.js"></script> <noscript>
<a href="http://polldaddy.com/poll/" originalAttribute="href" originalPath="http://polldaddy.com/poll/">Test</a><span style="font-size:9px;">
<a href="http://polldaddy.com/features-surveys/" originalAttribute="href" originalPath="http://polldaddy.com/features-surveys/">test2</a></span>
</noscript>

and of course, each time you switch from Design to HTML it keeps appending more and more of these extra attributes!
0
Rumen
Telerik team
answered on 16 Sep 2010, 11:12 AM
Hello Christian,

Thank you for your report. I logged it in our PITS system and we will do our best to fix it as soon as possible. The status of the issue could be checked at http://www.telerik.com/support/pits.aspx#/public/aspnet-ajax/3453.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tim
Top achievements
Rank 1
answered on 19 Mar 2017, 03:28 PM

Hi Telerik,

Was there a solution for this?  I am still encountering this issue.  In case it makes a difference, I am adding the anchor tag inside a script tag.  When I save and reopen the html, the originalAttribute and originalPath attributes get added in.

I have tried Rumen's OnClientLoad script and have tried disabling the MakeUrlsAbsolute but the attributes still get added.

<script>
 
search.addWidget(
  instantsearch.widgets.hierarchicalMenu({
    container: '#categories',
    attributes: ['categories.lvl0', 'categories.lvl1', 'categories.lvl2'],
    operator: 'or',
    templates: {
        header: 'Technology categories',
        item:  '<a href="javascript:void(0);" originalAttribute="href" originalPath="javascript:void(0);" class="facet-item {{#isRefined}}active{{/isRefined}}"><span class="facet-name"><em class="fa fa-angle-right"></em> {{name}}</span class="facet-name"><span class="ais-hierarchical-menu--count">{{count}}</span></a>'
   }
  })
);
 
</scrtpt>

 

-Tim

0
Rumen
Telerik team
answered on 19 Mar 2017, 10:30 PM

Hello Tim,

This is a very old bug that should not exist in the latest version.

Are you able to reproduce the problem in the following demo: http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx? If no, please upgrade to the latest version R1 2017 SP1.

Best regards,
Rumen
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tim
Top achievements
Rank 1
answered on 20 Mar 2017, 05:15 PM

Hi Rumen,

I was not able to reproduce the issue on the demo page.  

Usually all our projects have the most up to date Telerki Dlls.  This one project however proves to be tried and true and rarely needs maintenance.  As it turns out the Telerik.Web.UI.dll referenced is 2010.3.1109.35.   I might be going out on a limb here but it might be time to update this 7 year old dll.

-Tim

0
Rumen
Telerik team
answered on 20 Mar 2017, 08:22 PM

Hi Tim,

If you upgrade to the latest version you will not only solve this issue but also provide support for the latest browser versions. Another benefit is the Lightweight rendering of the controls available in the new version.

Best regards,
Rumen
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Editor
Asked by
Amey
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Amey
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Share this question
or