FreeTextBox

The no. 1 free ASP.NET HTML Editor.
Welcome to FreeTextBox Sign in | Join | Help
in Search

Paste via script disabled problem

Last post 05-15-2008, 9:44 AM by lyfschaos. 1 replies.
Sort Posts: Previous Next
  •  05-14-2008, 7:13 PM 9153

    Paste via script disabled problem

    First of all, I wanted to try to provide what I discovered so perhaps an improvement could be added so others did not have to re-figure out what I figured out. Secondly, I am aware that this "problem" probably only affects a very few people in a certain kind of environment. Third, a work around would be greatly appreciated.

    In our production environment the the "Paste via script" is disabled (Tools>Internet Options>Security>Custom Level or whatever, scroll down to near the bottom). This is a manditory setting over which I have no control. The freetextbox I created has PasteMode set to Text in order to strip out Word formatting and whatnot. What I found out is that the FTB-FreeTextBox.js code that handles the cleanup (around line 465 of so) is checking to see if the browser has the window.clipboardData object (which IE 6 does), but it is not checking if pasting from a script is available, which it is not when it is disabled. The result is that I get a javascript error and the browser allows pasting as if the pastemode were not set.

    It would be nice if code were included to check if the freetextbox were enabled as well, to alert the developer of what is going on.

    So rather than:

    if(window.clipboardData){
        //work
    }else{
        alert('Your browser does not support rich text pasting');
    }

    Maybe do this:
    if(typeOf clipboardData == 'undefined'){
    alert('Your browser does not support rich text pasting');
    }else if(clipboardData.getData('Text') == 'undefined'){
    alert('Your browser is set to block scripted pasting');
    }else{
    //do work
    }
    Again, is there a work around to strip HTML on pasting that aviod hitting the "Paste via scripting" wall? I know I can strip on the backend, but the requirement is for it to be stripped on the front-end and the IE setting is not going to be enabled.

    Thanks!! Great product by the way. I was all stoked to use it until I got into Production and hit this wall. Good work just the same.
  •  05-15-2008, 9:44 AM 9156 in reply to 9153

    Re: Paste via script disabled problem

    Another caviat is that when in PasteMode.Default NOTHING happens upon control-v or clicking the paste button... no error, no popup that would occur if the try statement located on line 483 were caught, nothing. However, if you try the this.InsertHtml method that is located in the CASE_FTB_TEXT, you get the alert telling you that your security settings do not allow you to do this. You DONT get that error if you use the this.InsertHtml method when in PasteMode.Text. Either this is really bizzar or I am just missing some concept.
View as RSS news feed in XML
www.freetextbox.com