If you open the developer tool to get the video
tag from Naver blogs or cafes and run document.getElementsByTagName('video') or
document.querySelectorAll('video')
you will find a strange empty array. What's more strange is that if you search <video
on the Elements tab with Ctrl+F
, once you click the part of the video tag you found and run document.getElementsByTagName('video')
again, you will return the normally. What the hell is the problem??
I answer myself... This is because the Naver video uses the iframe
tag.
document.querySelectorAll('iframe').forEach(item =>
item.contentWindow.document.body.querySelectorAll('video');
)
© 2024 OneMinuteCode. All rights reserved.