Welcome Guest Search | Active Topics | Sign In | Register

Is the Editor control supposed to remove javascript from the HTML content? Options
Fernando De Gasperis
Posted: Monday, December 15, 2008 12:25:12 PM
Rank: Newbie
Groups: Member

Joined: 12/4/2008
Posts: 5
Hello,

I am having a problem where an HTML which has a <script> section.

Here is the original HTML loaded into the control:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GBI participant invitation email</title>
<link type="text/css" rel="Stylesheet" href="http://www.sdlconnect2.com/sdparticipant/stylesheets/email.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>
<body>
<table border="0" cellspacing="0" style="MARGIN-LEFT:18px;">
<tr>
<td class="copyright" align="left">&copy; 2005-<script type="text/javascript">var d = new Date();document.write(d.getFullYear());</script> Senn Delaney Leadership Consulting Group, LLC.<br />United States 562.426.5400&nbsp;&#9474&nbsp;International +44 (0) 207 647 6060</td>
<td><img src="http://www.sdlconnect2.com/sdparticipant/images2/emails/sd_footer_logo.gif" width="175" height="42" alt="" style="margin-left:18px"></td>
</tr>
</table>
</body>
</html>




and here is what I get out of the HTML editor control:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GBI participant invitation email</title>
<link type="text/css" rel="Stylesheet" href="http://www.sdlconnect2.com/sdparticipant/stylesheets/email.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>
<body><table style="MARGIN-LEFT: 18px" cellSpacing="0" border="0">
<tbody>
<tr>
<td class="copyright" align="left">© 2005-<script type="text/javascript" /></td>
</tr>
</tbody>
</table>
</body>
</html>



Any suggestions on how and can keep the editor control from removing the script section?

Thank you,

Fernando De Gasperis
eo_support
Posted: Monday, December 15, 2008 12:48:25 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I do not believe the Editor will keep the script tag for you because it is not something that you can edit. A possible workaround for this is to replace the script tag with some static HTML tags and then replace then back with the original script block when done editing. For example, you can replace the script tag with something like this:

Code: HTML/ASPX
<div 
    class="css_class_for_script" 
    id="some_id_that_represent_the_js"></div>


The key points at here are:

1. You would usually need a special CSS class for such html elements so that it displays differently inside the editor;
2. You need to uniquely mark this element so that you can replace this element with your original script contents when done editing. Obviously you need to save your original script contents somewhere;

Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.