+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Disable hyperlinks in radEditor

Disable hyperlinks in radEditor

12 posts, 0 answered
  1. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    06 Aug 2009
    Link to this post
    Is there a way to disable javascript hyperlinks in the radEditor design mode? It looks like hyperlinks are disabled but if I double click on a link that runs javascript, I get the error "Object expected." I get the same error in Preview mode within the radEditor which I would also like to resolve. In preview mode, the javascript should run and open up a radWindow.
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Aug 2009
    Link to this post
    Hello,

    Could you please elaborate a bit more? Is this happening in the modules section, or in Page Edit mode with the Generic Content control? Does this seem like a browser specific issue? We haven't got such reports before. 

    Thank you in advance. 

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    13 Aug 2009
    Link to this post
    This is happening in page edit mode with the generic content control. It happens in every browser except for Google Chrome. Here are the steps to recreate the problem:

    Edit a generic content control in page edit mode
    In html mode, enter something like: <a href="#" onclick="some javascript here">Test</a>
    Go to design mode and click on the link. You will get a javascript error "Object expected."

    For our purposes, the onclick property usually has some javascript to open a radWindow.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Aug 2009
    Link to this post
    Hi Connections Academy Developer,

    You cannot get the window opening in Design Mode because RadEditor is Editable IFrame which is different page. There you do not event have RadScriptManager and you cannot use dynamically the ASP.NET AJAX convention.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    17 Aug 2009
    Link to this post
    I do not want the window to open in Design mode, I want the javascript error to be suppressed. In Preview mode I want the radwindow to open, is this possible?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Aug 2009
    Link to this post
    Hi Connections Academy,

    The situation with Preview mode is the same, since you are in RadEditor's IFrame.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    26 Aug 2009
    Link to this post
    Is there a way to completely disable javascript from running inside of a radEditor? 
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Aug 2009
    Link to this post
    Hello ,

    You can set AllowScripts to false. The property gets or sets the value indicating whether script tags will be allowed in the editor content.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    03 Sep 2009
    Link to this post
    Unfortunately we cannot set Allowscripts to false. We want to allow the user to enter script tags but we do not want javascript executed within the radEditor. Is there a workaround?
  10. Joe
    Joe avatar
    138 posts
    Registered:
    24 Sep 2012
    04 Sep 2009
    Link to this post
    Hello Connections Academy Developer,

    Thanks for the follow up.

    There are two ways to accomplish this functionality:

    1. JavaScript needs to be tied to an event, like on mouse over or on click. Have the user write functions that aren't tied to any controls.

    2. You could use the RadEditor's custom filters to remove Java Script on the page load event, since this would be the only code executed.

    Kindly let us know if you have any questions.

    Regards,
    Joe
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    22 Sep 2009
    Link to this post
    Thank you for your reply but your solutions did not work for me. Using custom filters completely removes the script tags from the radEditor and this is not what we want. We want to allow users to enter and view existing script but not execute it inside of the radEditor.
  12. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    24 Sep 2009
    Link to this post
    Hello,

    The RadEditor is an IFRAME so the our task here would be to stop the browser to execute the scripts. I do not think that this would be an easy task. 

    I am not sure if a solution to this requirement exists. Perhaps you could override some render event, check if you are in edit mode, find all JavaScript functions and replace their body with return void(0); Unfortunately the issue here is, how you will distinguish the Sitefinity JavaScript than yours.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
12 posts, 0 answered