1

I'm using to configure htmlpurifier at my system. i can authorize youtube iframes, but when i put a youtube-nocookie url, it is purified. the code above is whats i am doing. help me please? here is the code.

$config->set('HTML.SafeIframe', true);
$config->set('URI.SafeIframeRegexp', '%^(https?:)?(\/\/www\.youtube(?:-nocookie)?\.com\/embed\/)%');

can u help me please?

Tom
  • 4,070
  • 4
  • 22
  • 50
  • Can you elaborate what you mean by "purified"? – Tom Nov 04 '19 at 20:22
  • @Tom purified is deleted, when i put an iframe without "https://www.youtube.com/embed" url, it is deleted. the thing is: i need to accept both "youtube.com" and "youtube-nocookie.com". understood? – Hamilton Martins Nov 04 '19 at 20:25
  • 1
    Have a look at this question: https://stackoverflow.com/questions/44041062/how-to-validate-the-youtube-embedded-link-only-using-regular-expression . The regex they use there goes like this: `\/\/www.youtube(?:-nocookie)?.com\/(?:v|embed)\/([a-zA-Z0-9-_]+).*` – Tom Nov 05 '19 at 13:12

0 Answers0