Error: Audio playback was aborted IE 11 Windows 7 - javascript

I have folder structure like
Folder interactive_pages_test
C:\Users\username\Desktop\interactive_pages_test\test.html
C:\Users\username\Desktop\interactive_pages_test\2_Hot_Cross_Buns.mp3
Folder test
C:\Users\username\Desktop\test\test.html
C:\Users\username\Desktop\test\2_Hot_Cross_Buns.mp3
The files test.html and 2_Hot_Cross_Buns.mp3 are same. When I opened C:\Users\username\Desktop\interactive_pages_test\test.html in IE 11 it is throwing anError: Audio playback was aborted. But C:\Users\username\Desktop\test\test.html is playing fine in IE. In chrome and Mozilla both of the files are playing fine. Can any one please advice on this issue?
<html>
<head>
<title>Tile</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" >
alert("hi");
</script>
</head>
<body>
<audio src="./2_Hot_Cross_Buns.mp3" controls="">Audio not supported</audio>
</body>
</html>

Actually IE's in Windows 8 are above uses activeX control for playing audios, so when you the html file it prompts that ActiveX control is blocked, if you click on allow blocked content then it will play normally.
Prompt for activex
After Enabling blocked content

Related

Script is loaded from Live Server but not when opening index.html

I am new to JS. I made a simple Snake game using vanilla JS in VS Code. There is minimal CSS in the code so I put that in the html.
When I open the index.html from VS Code with Live Server (http://127.0.0.1:5500/) it works fine.
But when I open it from the file explorer (file:///D:/Prog/Javascript/VanillaJS_projects/Snake/index.html) only the html gets loaded, no Snake and Food pieces appear. And the same happens if I try to open it with htmlpreview.github.io
This is the index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Snake</title>
<script src="game.js" defer type="module"></script>
<style>
...
</style>
</head>
<body>
<div id="game-board"></div>
</body>
</html>
It doesn't matter what browser I use, I get the same result.
What is the difference? Why won't it load properly?
You browsers honor Content Security Policy.
If you open file:/// URLs, you may think of your browser as a poor man's file viewer.

How to access embedded openload iframe

I'm trying to get direct download links from embedded openload links (example: https://openload.co/embed/CoKeagPRpQg/). The result might look something like this: https://openload.co/stream/CoKeagPRpQg~1527355595~2a02:120b::~J-XBN0SR?mime=true. If you navigate to the embed link and run
document.querySelector("#mediaspace_wrapper > div:last-child > p:last-child")
from the developer console, the essential data for the stream link is returned. When I tried to implement this on an embedded video on my private site, I got an error for cross site scripting, which is understandable.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Proflix</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<iframe id="video" src="https://openload.co/embed/CoKeagPRpQg/" scrolling="no" frameborder="0" width="700" height="430" allowfullscreen="true"
webkitallowfullscreen="true" mozallowfullscreen="true">
</iframe>
</body>
</html>
However, I stumbled across this chrome extension, which with JavaScript alone can enter the iframe (Demo). This really puzzles me. I contacted the developer and he told me his extention was based on this script. But it didn't work from the developer console. My question is: How can JavaScript enter a foreign iframe in this example and how can I replicate it?
Related:
Get the unique download link on Openload
Get stream URL from openload

Why isn't my web page closing after the video?

It is pretty simple what I am trying to accomplish, but I think my website hates me. It is currently live at;
https://www.eves.website/eve_6.html
except it doesn't close the webpage after the video has finished. Why?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>eve_</title>
<link rel="icon" rel="preload" href="images/evecircle.png" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
$(document).ready(function(){
$("#myVideo").bind('ended', function(){
self.close();
});
});
</script>
</head>
<body>
<video id="myVideo" style="margin-left:-10px; margin-top:-10px;" width="105%" height="105%" autoplay>
<source src="images/death.mp4" autoplay="true" type="video/mp4" />
Your browser does not support the video tag.
</video>
</body>
</html>
How do you open your website? If you are opening by entering the URL in a new tab, it cannot be closed using JavaScript. The way you have put, the script has a requirement that the page to be closed, cannot be the original page.
It must be opened as a new window using JavaScript. If you wish to close a page that has been posted via form, the page must first have still been opened in a separate window using JavaScript.
From MDN for window.close():
In the past, when you called the window object's close() method directly, rather than calling close() on a window instance, the browser closed the frontmost window, whether your script created that window or not. This is no longer the case; for security reasons, scripts are no longer allowed to close windows they didn't open. (Firefox 46.0.1: scripts can not close windows, they had not opened).
If you are opening the site with the script then you can use this
document.getElementById('myVideo').addEventListener('ended',function(){
window.close();
}, false);

window.close not closing window in HTA application

In my HTA application I'm using a JavaScript calendar window, it opens using window.open() and closed using window.close(), when the user clicks on one of the dates. This calendar works fine on multiple browsers and versions over more than 10 years. It even works in HTA applications most of the time.
However on specific workstations running IE11. The window.close() command is simply ignored, resulting in the window left open. On other IE11 workstations it works fine. I figured that turning off the "Enable Protected Mode" checkbox on IE11, Internet Options, Security tab resolves the problem on one of the problematic workstation. However, other workstations works fine with this setting turned on and turning off this setting is not an acceptable solution.
Code sample which reproduces the problem:
HTA application
<HTML>
<HEAD>
<HTA:APPLICATION ID="OpenCloseExample" BORDER="thick" BORDERSTYLE="complex"/>
<TITLE>Open Close HTA container</TITLE>
</HEAD>
<iframe width="1024px" height="768px" src="http://localhost:28080/openclose.html"/>
</HTML>
openclose.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Main Page</title>
<script src="openclose.js"></script>
</head>
<body>
open
</body>
</html>
openclose.js
var win;
function openWindow() {
win = window.open("", "_blank", 'width=250,height=250,status=no,resizable=no,location=no,top=100,left=100');
win.document.writeln("<html><head><script src='openclose.js'></script></head><a href='#' onclick='javascript:window.opener.closeWindow()'>close</a></html>");
}
function closeWindow() {
win.window.close();
}
I can't see this working in any IE with any settings. The problem is this string: <script src='openclose.js'></script>. That is, a literal ending script tag in a string works as an ending script tag on a page, when HTML parser will find it. This means, that your script was never loaded.
To fix this, you've to break the literal tag, for example like so:
<script src='openclose.js'><\/script>
Since you have pointed out that IE11 is causing the JS not to work, you can force IE to render in an older version very easily.
<meta http-equiv="X-UA-Compatible" content="IE=9">
This meta tag is very popular amongst HTA applications for utilizing JS/ActiveX methods/properties within specific IE versions (most of them being deprecated).
For more information, visit the X-UA-Compatible Tag Wiki
Hope this helps
I figured this out eventually.
Changing:
open
to:
open
Has resolved the problem

SWF downloads twice in IE

I see SWFs download twice in IE, but not in Chrome. I'm using IE 11. I can see the download requests in the F12 dev tools Network tab and in server access logs. Below is a simple example that exhibits the problem. I'm using swfobject 2.2. I've tried calling swfobject.switchOffAutoHideShow() before calling swfobject.embedSWF(), but that doesn't help.
You can test this by putting the HTML and swfobject.js in the same directory and browsing from the disk, so you don't need an HTTP server to test/reproduce this.
Does anyone know why this happens and how to stop the second download?
<!DOCTYPE html>
<html>
<head>
<title>My Version</title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://www.adobe.com/swf/software/flash/about/flashAbout_info_small.swf",
"flashInfo", "100%", "100%", "9.0.0");
</script>
</head>
<body>
<div id="flashInfo">
<p>No flash here. Move along.</p>
</div>
</body>
</html>

Categories

Resources