Kentico v8 & CKEditor - YouTube embeds & https

Lawrence LeFebour asked on March 26, 2015 17:06

Hi there, we have enabled the YouTube toolbar button in the wysiwyg editor but whenever I attempt to insert a YouTube video, the form overlay switches the URL of the video from https to http. Our Kentico site is served over https and as a result, the video display is blocked by most browsers because of the mixed-mode content issue. How can I configure the CKEditor to always use https for YouTube video embeds?

Correct Answer

Brenden Kehren answered on March 29, 2015 08:50

Lawrence what version are you using? I understand this issue is resolved in 8.2.1

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on March 26, 2015 23:27

I believe it is with the widget and not the WYSIWYG editor as I ran into this with another site. I dug into the widget a bit and for the sake of time I just forced that page to not run under HTTPS. It was a simple solution without having to modify code and since there wasn't anything that really needed to be secure, it wasn't an issue.

0 votesVote for this answer Mark as a Correct answer

Lawrence LeFebour answered on March 27, 2015 00:59

Thanks Brenden but I don't think that will work in my scenario. Our Kentico site runs under https for our end users and YouTube now serves most if not all videos through its sharing interface through https. Does the CKEditor use the widget on the server side to embed YouTube videos? If yes, is it possible to edit the widget to always use https for YouTube videos?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 27, 2015 05:04

It would ultimately be the underlying webpart that the widget is made from or the more I think about it, it could be in the actual API.

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on March 27, 2015 07:01

Hello,

The problem is with the url it gets built up in the \CMSModules\Content\Controls\Dialogs\YouTube\YouTubeProperties.ascx.cs file in the FixPreviewUrl method. The easiest fix for you is to update the line 196:

url = String.Format("https://www.youtube.com/watch?v={0}", videoID);

Best regards,
Jan Hermann

1 votesVote for this answer Mark as a Correct answer

Lawrence LeFebour answered on March 27, 2015 14:39 (last edited on March 27, 2015 16:03)

Thanks Jan but the behavior appears to be controlled through some additional JavaScript as well. The text field that contains the URL appears to also have a JS 'onblur' event that changes the URL protocol to http immediately.

We've been searching through the code but haven't found the file yet. If you could point us in the right direction that would be much appreciated.

[update] When looking at the developer console in Chrome, the mixed mode warning I receive is on this page: /CMSFormControls/Selectors/InsertYouTubeVideo/Content.aspx. I believe this page is presented in the Admin overlay when adding a YouTube video.

0 votesVote for this answer Mark as a Correct answer

Lawrence LeFebour answered on March 29, 2015 16:31

Thanks Brenden - we are still using v8.1 - we will start looking at the changelog for v8.2.x and investigate the impact of upgrading and reply back to this thread.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 30, 2015 05:55

Lawrence, if you haven't written a lot of custom code, you should be good to do a standard upgrade. If that's not the case, then a little more investigation is worthwhile.

1 votesVote for this answer Mark as a Correct answer

Lawrence LeFebour answered on March 30, 2015 22:13

Thanks Brenden - applying the 8.2.1 hotfix has resolved this issue.

2 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.