WordPress.org

Ready to get started?Download WordPress

Forums

WP-HTML-Compression
[resolved] Version 0.5.1: iframe links are broken - YouTube does not work (9 posts)

  1. gerobe
    Member
    Posted 1 year ago #

    The relative link-format does not work for iframes.

    For exeample a code like

    <iframe src="http://youtube-nocookie.com/embed/IeTybKL1pM4?rel=0" frameborder="0" height="301" width="535"></iframe>

    becomes

    <iframe src="//youtube-nocookie.com/embed/IeTybKL1pM4?rel=0" frameborder="0" height="301" width="535"></iframe>

    Which results in a Google "URL not found" message displayed in the iframe and not the video.

    URLs in iframe tags should not be changed.

    http://wordpress.org/extend/plugins/wp-html-compression/

  2. Steven Vachon
    Member
    Plugin Author

    Posted 1 year ago #

    It works fine, it's just that some websites set themselves up to not load within frames.

    Try doing <iframe src="http://google.com/"></iframe>, it won't work either.

  3. gerobe
    Member
    Posted 1 year ago #

    Sorry, that was my fault. I have chosen and example which did not allow embedding to show the error :-)

    But now: Try

    <iframe style="border: 1px solid #cccccc;" width="560" height="315" src="http://www.youtube-nocookie.com/embed/7Q2zxBTnjUo?rel=0" frameborder="0" allowfullscreen></iframe>

    This works!

    <iframe style="border: 1px solid #cccccc;" width="560" height="315" src="//www.youtube-nocookie.com/embed/7Q2zxBTnjUo" frameborder="0" allowfullscreen></iframe>

    Does not work!

  4. Steven Vachon
    Member
    Plugin Author

    Posted 1 year ago #

    Both examples work fine here. Outside of a browser bug, there's no reason why an "http://" would work and a "//" would not, because the browser resolves it to absolute when the location is changed.

  5. gerobe
    Member
    Posted 1 year ago #

    Well, my example wasn't correct again :(

    I just checked it with Firefox and Safari on a Mac and with IE on Windows: none of the browsers showed the movie as soon as the plugin was enabled. So it does not seem to be a browser problem.

    Looking closer at the code I found out, that the problem is not the missing http: but a missing www.:

    I just checked the code again and a:

    <iframe style="border: 1px solid #cccccc;" width="560" height="315" src="http://www.youtube-nocookie.com/embed/7Q2zxBTnjUo?rel=0" frameborder="0" allowfullscreen></iframe>

    actually becomes a

    <iframe style="border: 1px solid #cccccc;" width="560" height="315" src="//youtube-nocookie.com/embed/7Q2zxBTnjUo?rel=0" frameborder="0" allowfullscreen></iframe>

    Notice the missing www. before the domain. Without the www. the url-calls on the server youtube-nocookie.com do not work.

    So the plugin accidentally removes the www. before the url, which causes the not working movies. I wonder why it's removing the www. which is definately wrong in this case.

  6. Steven Vachon
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, there we go :) thanks

    I guess incorrectly configured servers are more popular than I had thought. I'll have to disable the "ignore www" feature by default, then.

  7. gerobe
    Member
    Posted 1 year ago #

    Great, that I got it on the third run ;-)

    I just replaced the two appearances of $ignore_www=true in absolute-to-relative-urls.php into false and now the videos are back again.

  8. Steven Vachon
    Member
    Plugin Author

    Posted 1 year ago #

    Yep. Fixed in 0.5.2

  9. gerobe
    Member
    Posted 1 year ago #

    Thank you! Works!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic