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

[Solved] Javascript in snippets

3 Answers 59 Views
RadEditor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nigel
Top achievements
Rank 1
Nigel asked on 17 Oct 2006, 01:33 AM

Hi there,

I've created a snippet with a mailto tag in it, which works fine. However, I'm trying to add javascript to the snippet to insert the current page/location into the subject, however the javascript is ignored.

I saw a thread where you edit the config file, and add a tag to one of the pages to point to the config file, however this isn't working.

Any help would be appreciated.



<snippet name="Support Contact">


<![CDATA[

<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
var OnLoadDone = false;

window.attachEvent("onload", new Function("StocklandContact();"));

function StocklandContact()
{
 try{
 
  //Check if already altered
  if (!OnLoadDone)
  {
        var strPage = '';
        strPage = document.URL;  // or document.referrer;

//        if (strReferrer != '')
//          strReferrer = document.location;

        var objAnchor = document.getElementById("AnchorHref");
        if (objAnchor != null)
        {
          strPage.replace(":", "%3A");
          strPage.replace(" ", "+");
          objAnchor.href = objAnchor.href + " " + strPage;
        }
        OnLoadDone = true;
   }
  }
   catch(ex) {
     // do nothing
     OnLoadDone = true;
   }
}
//-- Stop hiding script -->
</SCRIPT>
 


<table class="ms-contactboxbg"><tr>
<td>
Contact:<br/>
<a id="AnchorHref" href="mailto:DL_IT_Intranet_SPSAdmin@stockland.com.au?subject=Feedback%20for%20Intranet%20site">Intranet Support</a>
</td></tr></table>

    
]]>

</snippet>

3 Answers, 1 is accepted

Sort by
0
Dimitar Milushev
Telerik team
answered on 20 Oct 2006, 01:24 PM

Hello Nigel,

You need to set the AllowScripts property to true in your ConfigFile.xml

The file is usually located in "C:\inetpub\wwwroot\wpresources\RadWebParts\RadControls\Editor". Open it with a text editor and add the following line after the <configuration> tag:

<property name="AllowScripts">true</property>

Greetings,
Dimitar Milushev
the telerik team
0
Darchele
Top achievements
Rank 1
answered on 12 Jul 2007, 01:39 PM
I am using the RadEditor 7.0.2 and have tried to set the ConfigFile.xml flag AllowScripts to true, but the javascript is still stripped out.  Is there something else I need to do using this version?

I got it.  I needed to add something like &nbsp before the script for it to render
0
Rumen
Telerik team
answered on 12 Jul 2007, 01:57 PM
Hi Darchele,

Indeed the SCRIPT tags should not be placed at the beginning of the content because in other case the browser will strip them. The solution with the &nbsp; entity that you use is actually the workaround that we provide to our customers that experience the same problem.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
RadEditor
Asked by
Nigel
Top achievements
Rank 1
Answers by
Dimitar Milushev
Telerik team
Darchele
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or