Jump to content

How I force my browser (Google Chrome or Microsoft Edge) to play audio from a prototype website located within my PC.


Audiophile

Recommended Posts

When I create a new website, I test the prototype by opening the index.html file with my browser (Google Chrome or Microsoft Edge).  But the browser refuses to play the audio content (if present).  I don't know why, but this is probably intentional.

 

I have discovered that the browser can be forced to play the audio content if the prototype website is played through the html "iframe" tag. This seems to work perfectly well but I have no idea why. Here follow the instructions to achieve this:

 

(1).  Inside the index.html file insert the following code:

<a target="_self" href="FREDS-SUBSEQUENT-file.html">

<iframe class="FREDS-CSS-label" src="FREDS-folder/FREDS-file.html" style

="height:1024px;width:100%; border:none;">

</iframe>

</a>

 

Note: The above code <a target="_self" href="FREDS-SUBSEQUENT-file.html">

may be unnecessary.  (It would provide a hyperlink if the file in FREDS-folder were a .jpg or other graphic file).

 

(2).  It is better NOT to insert your "audio" code inside the index.html file.  If you do, the "audio" will not play when the index.html file first runs. However, the "audio" would play if the "index.html" file runs subsequently.

 

(3). Unless you already have a stylesheet, inside <head> </head> insert:

<link rel="stylesheet" href="mystyle.css">

 

(4). Inside the CSS file "mystyle=css" insert the following code:

@media only screen {

.FREDS-CSS-label {

display: block;

width: 100%;

align: center;

    }

}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...