2

Code (just for reference):

<!DOCTYPE html>
    <html>
    <head>

    </head> 
    <body>

    <div style="font-size:30px; width:100%; text-align:center; 
    border:solid 1px black;">YouTube: </div>
    <br><iframe src="https://www.youtube.com/embed/5H9hmO4t-I" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/BHgh4_1ksGQ&t" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/mHhZ9jk-DrU" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/Esw9vyF0MGw" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/kzXzsjkNwVE"  
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/IlotMjmFf-Q" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/lpbzph6O6pc" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/scyYfbL5P9w" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/fwfUE5FLJBs" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/xocBqB5bARY" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/o8SDQ29-wfE" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>
    <iframe src="https://www.youtube.com/embed/rUely4qsxaQ" 
    frameborder=0 width=510 height=400 scrolling=no 
    allowfullscreen=allowfullscreen></iframe>

    </body>
    </html>

I have created this html file that holds multiple iframe windows of youtube videos and want to copy html that is generated when the page is run. When iframe fails to load or something similar happens there is a text "An error occurred please try again later" that is generated under iframe in #document line and I want to copy all generated html because of this. I can copy this line but have to go one by one. When I select html tag and select copy html it does copy just original html. I tried web developer extension, tried firebug(omnibug) add-on in mozilla, tired copying inner html with mozilla extension but it just copies original html.

Does anybody have an idea how can I fix this?

cheshire
  • 1,109
  • 3
  • 15
  • 37
  • 1
    You cannot access the iFrame content from another origin. This sounds like an X/Y problem. What is the actual reason for this? If you want to see if the frame loads, you can add onload and onerror on the tags – mplungjan Aug 29 '18 at 10:39
  • Replace the iframes with divs and use AJAX to retrieve the contents of the URLs and put in in them with innerHTML. – Mr Lister Aug 29 '18 at 10:44
  • @mplungjan I have a bunch of links that I generate iframe for and a lot of them are deleted or won't load. I wan't to copy inner html to retrieve title or ID of the links that are deleted or won't load: I had in mind to copy that in .txt file and with some java code get the titles or IDs. Do you have some other idea how can I do this? – cheshire Aug 29 '18 at 10:52
  • I would CURL on the server and look for the error and simply not show the iframe – mplungjan Aug 29 '18 at 10:58
  • Can you show the exact error please i think i know the fix but i want to make sure – connorg98 Aug 29 '18 at 11:41
  • @connorg98 I removed one letter from video ID and there is a error now i the code above. The one that I look to extract is "An error occurred. Please try again later. (Playback ID: dUQlFhahgH0Am-gR) " which is inside a generated #document under div class ytp-error ytp-related-on-error – cheshire Aug 29 '18 at 14:21
  • So you removed a letter from the embedded video link? – connorg98 Aug 29 '18 at 14:23
  • @connorg98 yes, first iframe and now there is an error if you try to play that video when you run the code – cheshire Aug 29 '18 at 14:24
  • Have you tried putting the letter back? – connorg98 Aug 29 '18 at 14:25
  • @connorg98 I intentionally produced the error to show you what I want to be able to do – cheshire Aug 29 '18 at 14:29

0 Answers0