ok so im working with execCommand and trying to make a function to insert a youtube video into a content editable div with execcommand inserthtml. Now this works with every other browser except, OMG IE. now i am trying to use pasteHTML(), found that some people have gotten it to work, for its part but for some reason it is not working

please dont tell me to go and use a already created editor. im tired of seeing that lame excuse all over the web.

here is what i got already

insertYouTube: function () { /* This can be improved */
		var urlPrompt = prompt("Enter Youtube Url:", "http://");
		var urlReplace = urlPrompt.replace("watch?v=", "embed/");
		var embed = '<iframe title="YouTube video player" src="'+urlReplace+'" allowfullscreen="true" width="480" frameborder="0" height="390">';
			document.execCommand("Inserthtml", false, embed);

thanks in advance

you know whats crazy. is that no one in the javascript forms seems to want to help anyone else.

im not talking about this one post. but i have posted multiple times with out a single reply to any.


Member Avatar

i've seen somewhere that in order to make insert html work in ie you have to make another
div (a new div) and insert html in ther (using innerHTML for example) nad then insert the div element in the content you have..

also try out this link

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.