Search Keyword:

10Aug

Configuring TinyMCE to allow embed tags

Posted by admin as PHP

This post is on how to configure TinyMCE to allow embed tags which TinyMce
is stripping when the user press the Update button in the HTML editor.

When you are embedding Youtube videos,you’ll just have to get the embed code in the video page and just paste it in the editor.The editor(by default) strips out the embed tags in the embed code leaving only the object code and some params.The code that is stripped out will still play in Mozilla Firefox and Google Chrome but doesn’t play or doesn’t even show up in Internet Explorer.IE needs the embed tag for it to play.Here’s how the configuration for it to allow embed tags:

In your TinyMCE init, include the media plugin and set the media_script to false.

tinyMCE.init({ 

   //your other options here

   plugins: "media", //you can include other plugins that you will need here

   // allow embed tags
   media_strict: false 

});

That’s it.You can read more about TinyMCE’s media_script configuration by clicking here.

null

BoxUK has provided a checklist that needs to be considered and checked before launching your website or website application.The pre launch checklist includes factors to be checked involving content and style,standards and validation,search engine visibility,SEO and Metrics,functional testing,security/risk,performance and finishing touches.Post launch checklist includes marketing and ongoing categories on how you can maintain and update your website efficiently.

This list is a big help for me and serves as a guide when launching a new website or web application and I’m sure it will be useful to you as well.You can download a PDF version for you to print or save by clicking here.

This javascript function together with some Jquery goodness selects the text inside an html element like highlighting with your mouse and works even the element is not an input type or textarea.It is cross browser compatible and is working in IE, Safari, Opera, Chrome and Firefox.This can be useful if you want to highlight some text in a paragraph tag or span tag or even in a div tab upon clicking on a part of the text so that your users would not bother dragging their mouse to select the whole text they want to copy.See the demo by clicking here.

HTML code:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Selecting text in html elements with Jquery demo page</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="highlight_text.js"></script>
<style type="text/css">
body{
font-family:Verdana;
font-size:16px;

}
p{
border:1px dashed #333;
width:500px;
line-height:36px;
}
</style>
</head>
<body>

<div align="center">

  <p id="highlited_text">Click on any area inside the box 
 to highlight all of my text.</p>
</div>
</body>
</html>

Our HTML code is pretty simple,just a div with a paragraph tag that has an id of “highlighted_text”,some css code for styling our page, and links to the jquery core and our function inside the head tags.

highlight_text.js

$(document).ready(function() {
    
    
$('#highlited_text').click(
  function(){
    SelectText('highlited_text');
  }
);
  
function SelectText(element) {
    var text = document.getElementById(element);
    if ($.browser.msie) {
        var range = document.body.createTextRange();
        range.moveToElementText(text);
        range.select();
    } else if ($.browser.mozilla || $.browser.opera) {
        var selection = window.getSelection();
        var range = document.createRange();
        range.selectNodeContents(text);
        selection.removeAllRanges();
        selection.addRange(range);
    } else if ($.browser.safari) {
        var selection = window.getSelection();
        selection.setBaseAndExtent(text, 0, text, 1);
    }
}
  
});

You can also trigger the function by clicking a button or clicking another div or an anchor tag. It depends on your preferences.By the way,Happy Valentine’s day everyone!

Sponsored Links



Recent Comments

  • anup: thanx it helped me alot…
  • admin: try to look at window.location function of Javascript and place it under the success function of the AJAX...
  • ana: it works for me, but after success, how can i forward the url to a certain page? thanks
  • admin: Hello Don, do these steps again and again until the PSP reboots. Restore your PSP’s Default settings in SYstem...
  • don sb: my psp was already hacked then i changed the screen cos it broke,so at one point the battery lost total...