Hello,
I have an iframe in which I am embedding an external website that contains a video. When the video is fully watched, it calls the function “video_completed”.
Now I have the following script:
<iframeIsDeclaredHere></iframe>
<script>
const isVideoMessage = message =>
message.origin === "https://video.test.com" &&
message.data &&
message.data.type &&
message.data.type.startsWith("va_");
Whenever I do that, it says the const has already been declared.
So I thought I will use it within a “try” block:
<iframeIsDeclaredHere></iframe>
<script>
**try {**
const isVideoMessage = message =>
message.origin === "https://video.test.com" &&
message.data &&
message.data.type &&
message.data.type.startsWith("va");
} catch (err) {
alert('Error');
}
Then, it says the const is not declared at all.
So either I have it declared multiple times or not at all. What can I do? Thanks a lot for your help!