
Muting the audio source of an HTML page embedded in an iframe can be challenging due to browser security policies and the same-origin policy. Here are some methods you can consider:
1. Control the Source Page
If you have control over the content of the iframe (i.e., the page being embedded), you can directly modify that page to mute audio. You can do this by using the HTML5 <audio>
or <video>
elements with the muted
attribute:
- <audio controls muted>
- <source src="audio-file.mp3" type="audio/mpeg">
- Your browser does not support the audio element.
- </audio>
2. Using JavaScript
If you can r
Muting the audio source of an HTML page embedded in an iframe can be challenging due to browser security policies and the same-origin policy. Here are some methods you can consider:
1. Control the Source Page
If you have control over the content of the iframe (i.e., the page being embedded), you can directly modify that page to mute audio. You can do this by using the HTML5 <audio>
or <video>
elements with the muted
attribute:
- <audio controls muted>
- <source src="audio-file.mp3" type="audio/mpeg">
- Your browser does not support the audio element.
- </audio>
2. Using JavaScript
If you can run JavaScript on the page inside the iframe, you can programmatically mute audio elements. For example:
- document.querySelectorAll('audio, video').forEach(media => {
- media.muted = true;
- });
3. Cross-Origin Restrictions
If the iframe is from a different origin (a different domain), you won't be able to access its content directly due to the same-origin policy. In this case, you have a few options:
- Request the Source Page to Support Mute: You can ask the owner of the page being embedded to add a mute feature or API for controlling the audio.
- Use PostMessage API: If you control both the main page and the iframe content, you can use the
postMessage
API to send a message from the main page to the iframe to trigger muting:
In the main page:
- const iframe = document.getElementById('myIframe');
- iframe.contentWindow.postMessage('mute', '*');
In the iframe page:
- window.addEventListener('message', function(event) {
- if (event.data === 'mute') {
- document.querySelectorAll('audio, video').forEach(media => {
- media.muted = true;
- });
- }
- });
4. CSS Workaround
If the audio is playing through an element that can be hidden, you could also hide that element using CSS, but this won't stop the audio from playing:
- audio, video {
- display: none;
- }
Conclusion
The best approach depends on whether you control the iframe content or not. If you do, you have more options for muting audio. If you don't, you may need to rely on communication methods like the postMessage
API to achieve your goal.
You won't be able to mute the external audio because browsers prevent you from inspecting/interacting with the DOM of embedded pages (for security reasons). Calling document.getElementsByTagName didn't work because that only queries the main document, not the embedded documents.
The only real solution I can think of is to write a proxy in a server-side language and embed the pages via your proxy. You can write the proxy so that it strips out audio tags.
1. Overpaying on Auto Insurance
Believe it or not, the average American family still overspends by $461/year¹ on car insurance.
Sometimes it’s even worse: I switched carriers last year and saved literally $1,300/year.
Here’s how to quickly see how much you’re being overcharged (takes maybe a couple of minutes):
- Pull up Coverage.com – it’s a free site that will compare offers for you
- Answer the questions on the page
- It’ll spit out a bunch of insurance offers for you.
That’s literally it. You’ll likely save yourself a bunch of money.
2. Overlook how much you can save when shopping online
Many people over
1. Overpaying on Auto Insurance
Believe it or not, the average American family still overspends by $461/year¹ on car insurance.
Sometimes it’s even worse: I switched carriers last year and saved literally $1,300/year.
Here’s how to quickly see how much you’re being overcharged (takes maybe a couple of minutes):
- Pull up Coverage.com – it’s a free site that will compare offers for you
- Answer the questions on the page
- It’ll spit out a bunch of insurance offers for you.
That’s literally it. You’ll likely save yourself a bunch of money.
2. Overlook how much you can save when shopping online
Many people overpay when shopping online simply because price-checking across sites is time-consuming. Here is a free browser extension that can help you save money by automatically finding the better deals.
- Auto-apply coupon codes – This friendly browser add-on instantly applies any available valid coupon codes at checkout, helping you find better discounts without searching for codes.
- Compare prices across stores – If a better deal is found, it alerts you before you spend more than necessary.
Capital One Shopping users saved over $800 million in the past year, check out here if you are interested.
Disclosure: Capital One Shopping compensates us when you get the browser extension through our links.
3. Not Investing in Real Estate (Starting at Just $20)
Real estate has long been a favorite investment of the wealthy, but owning property has often felt out of reach for many—until now.
With platforms like Ark7, you can start investing in rental properties with as little as $20 per share.
- Hands-off management – Ark7 takes care of everything, from property upkeep to rent collection.
- Seamless experience – Their award-winning app makes investing easy and efficient.
- Consistent passive income – Rental profits are automatically deposited into your account every month.
Now, you can build your own real estate portfolio without needing a fortune. Ready to get started? Explore Ark7’s properties today.
4. Wasting Time on Unproductive Habits
As a rule of thumb, I’d ignore most sites that claim to pay for surveys, but a few legitimate ones actually offer decent payouts.
I usually use Survey Junkie. You basically just get paid to give your opinions on different products/services, etc. Perfect for multitasking while watching TV!
- Earn $100+ monthly – Complete just three surveys a day to reach $100 per month, or four or more to boost your earnings to $130.
- Millions Paid Out – Survey Junkie members earn over $55,000 daily, with total payouts exceeding $76 million.
- Join 20M+ Members – Be part of a thriving community of over 20 million people earning extra cash through surveys.
With over $1.6 million paid out monthly, Survey Junkie lets you turn spare time into extra cash. Sign up today and start earning from your opinions!
5. Paying off credit card debt on your own
If you have over $10,000 in credit cards - a debt relief program could help you lower your total debt by an average of 23%.
- Lower your total debt – National Debt Relief works with creditors to negotiate and settle your debt for less than you owe.
- One affordable monthly payment – Instead of managing multiple bills, consolidate your payments into one simple, structured plan.
- No upfront fees – You only pay once your debt is successfully reduced and settled, ensuring a risk-free way to tackle financial burdens.
Simple as that. You’ll likely end up paying less than you owed and could be debt free in 12-24 months. Here’s a link to National Debt Relief.
6. Overspending on Mortgages
Overpaying on your mortgage can cost you, but securing the best rate is easy with Bankrate’s Mortgage Comparison Tool.
- Compare Competitive Rates – Access top mortgage offers from trusted lenders.
- Personalized results – Get tailored recommendations based on your financial profile.
- Expert resources – Use calculators to estimate monthly payments and long-term savings.
Don’t let high rates limit your financial flexibility. Explore Bankrate’s Mortgage Comparison Tool today and find the right mortgage for your dream home!
7. Ignoring Home Equity
Your home can be one of your most valuable financial assets, yet many homeowners miss out on opportunities to leverage its equity. Bankrate’s Best Home Equity Options helps you find the right loan for renovations, debt consolidation, or unexpected expenses.
- Discover top home equity loans and HELOCs – Access competitive rates and terms tailored to your needs.
- Expert tools – Use calculators to estimate equity and project monthly payments.
- Guided decision-making – Get insights to maximize your home’s value while maintaining financial stability.
Don’t let your home’s value go untapped. Explore Bankrate’s Best Home Equity Options today and make your equity work for you!
8. Missing Out on Smart Investing
With countless options available, navigating investments can feel overwhelming. Bankrate’s Best Investing Options curates top-rated opportunities to help you grow your wealth with confidence.
- Compare investments – Explore stocks, ETFs, bonds, and more to build a diversified portfolio.
- Tailored insights – Get tailored advice to match your financial goals and risk tolerance.
- Maximize returns – Learn strategies to optimize investments and minimize risks.
Take control of your financial future. Explore Bankrate’s Best Investing Options today and start building a stronger portfolio today!
Disclaimer:
Found is a financial technology company, not a bank. Business banking services are provided by Piermont Bank, Member FDIC. The funds in your account are FDIC-insured up to $250,000 per depositor for each account ownership category. Advanced, optional add-on bookkeeping software available with a Found Plus subscription. There are no monthly account maintenance fees, but transactional fees for wires, instant transfers, and ATM apply. Read more here: Fee Schedule
You need to use a muted attribute to mute audio file in HTML.
Example
- <audio controls muted>
- <source src="guitar.mp3" type="audio/mpeg">
- </audio>
Start with this:
from W3schools:
<!DOCTYPE html>
<html>
<body>
<button onclick="getVolume()" type="button">What is the volume?</button>
<button onclick="setHalfVolume()" type="button">Set volume to 0.2</button>
<button onclick="setFullVolume()" type="button">Set volume to 1.0</button><br>
<video id="myVideo" width="320" height="176" controls>
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<script>
var vid = document.getElementById("myVideo");
function getVolume() {
alert(vid.volume);
}
function setHalfVolume() {
vid.volu
Start with this:
from W3schools:
<!DOCTYPE html>
<html>
<body>
<button onclick="getVolume()" type="button">What is the volume?</button>
<button onclick="setHalfVolume()" type="button">Set volume to 0.2</button>
<button onclick="setFullVolume()" type="button">Set volume to 1.0</button><br>
<video id="myVideo" width="320" height="176" controls>
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<script>
var vid = document.getElementById("myVideo");
function getVolume() {
alert(vid.volume);
}
function setHalfVolume() {
vid.volume = 0.2;
}
function setFullVolume() {
vid.volume = 1.0;
}
</script>
<p>Video courtesy of <a href="Big Buck Bunny" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>
- <video autoplay muted loop playsinline controls"true" class="wl_video_bg">
- <source src="./videos/wl_video_bg.mp4" type="video/mp4">
- Your browser does not support HTML video.
- </video>
if you are asking from code side we mute like this so you can unmute
if you want unmute(if controls not there) in website right click on video then select “show contols” then you can unmute there.
Most car insurance companies are kind of banking on you not noticing that they’re overcharging you. But unlike the olden days where everything was done through an agent, there are now several ways to reduce your insurance bills online. Here are a few ways:
1. Take 2 minutes to compare your rates
Here’s the deal: your current car insurance company is probably charging you more than you should be paying. Don’t waste your time going from one insurance site to another trying to find a better deal.
Instead, use a site like Coverage.com, which lets you compare all of your options in one place.
Most car insurance companies are kind of banking on you not noticing that they’re overcharging you. But unlike the olden days where everything was done through an agent, there are now several ways to reduce your insurance bills online. Here are a few ways:
1. Take 2 minutes to compare your rates
Here’s the deal: your current car insurance company is probably charging you more than you should be paying. Don’t waste your time going from one insurance site to another trying to find a better deal.
Instead, use a site like Coverage.com, which lets you compare all of your options in one place.
Coverage.com is one of the biggest online insurance marketplaces in the U.S., offering quotes from over 175 different carriers. Just answer a few quick questions about yourself and you could find out you’re eligible to save up to $600+ a year - here.
2. Use your driving skills to drop your rate
Not every company will do this, but several of the major brand insurance companies like Progressive, Allstate, and Statefarm offer programs that allow you to use a dash cam, GPS, or mobile app to track your driving habits and reduce your rates. You just have to do it for a month typically and then they’ll drop your rate.
You can find a list of insurance companies that offer this option - here.
3. Fight speeding tickets and traffic infractions
A lot of people don’t realize that hiring a lawyer to fight your traffic violations can keep your record clean. The lawyer fee oftentimes pays for itself because you don’t end up with an increase in your insurance. In some cities, a traffic lawyer might only cost $75 per infraction. I’ve had a few tickets for 20+ over the speed limit that never hit my record. Keep this in mind any time you get pulled over.
4. Work with a car insurance company that rewards you for your loyalty
Sticking with the same car insurance provider should pay off, right? Unfortunately, many companies don’t truly value your loyalty. Instead of rewarding you for staying with them, they quietly increase your rates over time.
But it doesn’t have to be this way. Some insurers actually reward long-term customers with better deals and additional perks. By switching to a company that values loyalty - like one of the loyalty rewarding options on this site - you can enjoy real benefits, like lower premiums, better discounts, and added coverage options tailored just for you.
5. Find Out If Your Car Insurance Has Been Overcharging You
You can’t count on your car insurance provider to give you the best deal—they’re counting on you not checking around.
That’s where a tool like SavingsPro can help. You can compare rates from several top insurers at once and let them pitch you a better price.
Did you recently move? Buy a new car? Get a little older? These changes can mean better rates, and SavingsPro makes it easy to see if switching providers could save you money.
All it takes is a few minutes to answer these questions about your car and driving habits. You’ll quickly see if it’s time to cancel your current insurance and switch to a more affordable plan.
These are small, simple moves that can help you manage your car insurance properly. If you'd like to support my work, feel free to use the links in this post—they help me continue creating valuable content. Alternatively, you can search for other great options through Google if you prefer to explore independently.
If you’re creating the page hosting the audio then it’s on you, the loop attribute is not required for the audio to work, but it will require users to press play.
If you add a loop then the only way to stop it is for the user to press pause.
YES.
The src attribute specifies the location (URL) of the external resource.
SRC Attribute can be used on the following elements:
- <audio>
- <img>
- <embed>
- <video>
- <input>
- <iframe>
- <track>
- <script>
- <source>
For the examples of real usage of SRC attribute in the above elements, refer to this w3schools page.
a frame is hyst basically a container that holds data on another source… tears ago this was the only way to do it but recent adavnces ith web technology mean the iframe isnt realy needed anymore… take youtube as an example, when you put a youtube video on a page it uses an iframe, the video is still on youtube but theres a frame on your site that contains the video… however the use of iframes and frames in generalisnt limited to youtube, you can embed an entire webpage into a frame
With today’s modern day tools there can be an overwhelming amount of tools to choose from to build your own website. It’s important to keep in mind these considerations when deciding on which is the right fit for you including ease of use, SEO controls, high performance hosting, flexible content management tools and scalability. Webflow allows you to build with the power of code — without writing any.
You can take control of HTML5, CSS3, and JavaScript in a completely visual canvas — and let Webflow translate your design into clean, semantic code that’s ready to publish to the web, or hand off
With today’s modern day tools there can be an overwhelming amount of tools to choose from to build your own website. It’s important to keep in mind these considerations when deciding on which is the right fit for you including ease of use, SEO controls, high performance hosting, flexible content management tools and scalability. Webflow allows you to build with the power of code — without writing any.
You can take control of HTML5, CSS3, and JavaScript in a completely visual canvas — and let Webflow translate your design into clean, semantic code that’s ready to publish to the web, or hand off to developers.
If you prefer more customization you can also expand the power of Webflow by adding custom code on the page, in the <head>, or before the </head> of any page.
Trusted by over 60,000+ freelancers and agencies, explore Webflow features including:
- Designer: The power of CSS, HTML, and Javascript in a visual canvas.
- CMS: Define your own content structure, and design with real data.
- Interactions: Build websites interactions and animations visually.
- SEO: Optimize your website with controls, hosting and flexible tools.
- Hosting: Set up lightning-fast managed hosting in just a few clicks.
- Grid: Build smart, responsive, CSS grid-powered layouts in Webflow visually.
Discover why our global customers love and use Webflow | Create a custom website.
You can't. If the URL isn't in the HTML, how would the browser know where to get it?
But there is a trick that can solve your purpose.
html file *
- <html>
- <body>
- <iframe id="iframe" src=""></iframe>
- <script src="main.js"></script>
- </body>
- </html>
main.js file *
- var iframe = document.querySelector('#iframe');
- iframe.setAttribute('src', 'http://your-website.org/some-link-to-iframe/');
Though it removes the url from iframe, the javascripts dynamically add that.
Hope it helps!
Same reason bread is not toasted in kitchens using the dishwasher.
There is no reason to even begin to fathom the idea of using the <script> tag for audio. There are things for audio, and <script> is not it. <script> is for other stuff. It looks like it is for other stuff and everyone knows it is.
You can know about HTML5 at w3schools.com or you can use "amazing audio player", it creates great audio players with loads of features and is compatible with all HTML enabled browsers
Hi,
Many top websites are applying this technique. Maybe, canvas technique can be use to hide the content. But exactly how it is used that i don’t know. Sorry :(
Can you be more specific on which tag file or files you wanting to play? Audio, video?
You can use javascript to load the source, and it will not be visible in iframe url
in page source code. For example,
- <script type="text/javascript">
- $(document).ready(function(e) {
- $('iframe').attr('src','http://www.flickr.com/');
- });
- </script>
- <body>
- <iframe src="" />
- </body>
I assume you are using the HTML5 audio element, all you need is to set the loop property of the element to true. See a sample JS code below
var audioElement=document.createElement(‘audio’);
audioElement.src=’audio-source.mp3′;
audioElement.loop=true; // makes browser never stop playing the audio - this is what you need
audioElement.volume=1;
audioElement.classList.add(‘no-display’);
audioElement.play();
// document.body.appendChild(audioElement);
the above line I commented is optional
but on Chrome and some other browsers, you have to tie this to a real user-triggered event - maybe when the user clicks
I assume you are using the HTML5 audio element, all you need is to set the loop property of the element to true. See a sample JS code below
var audioElement=document.createElement(‘audio’);
audioElement.src=’audio-source.mp3′;
audioElement.loop=true; // makes browser never stop playing the audio - this is what you need
audioElement.volume=1;
audioElement.classList.add(‘no-display’);
audioElement.play();
// document.body.appendChild(audioElement);
the above line I commented is optional
but on Chrome and some other browsers, you have to tie this to a real user-triggered event - maybe when the user clicks a button or so because it will not start playing if you call the function onload
An audio, using the user agent default set of controls, with one source.
- <audio controls
- src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga">
- Your user agent does not support the HTML5 Audio element.
- </audio>
An audio, using the user agent default set of controls, with alternative sources.
- <audio controls>
- <source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.mp4"
- type='audio/mp4'>
- <source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
- type='audio/ogg; codecs=vorbis'>
- <p>Your user agent does not support the HTML5 Audio element.</p>
- </audi
An audio, using the user agent default set of controls, with one source.
- <audio controls
- src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga">
- Your user agent does not support the HTML5 Audio element.
- </audio>
An audio, using the user agent default set of controls, with alternative sources.
- <audio controls>
- <source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.mp4"
- type='audio/mp4'>
- <source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
- type='audio/ogg; codecs=vorbis'>
- <p>Your user agent does not support the HTML5 Audio element.</p>
- </audio>
Yes but you have to use it inside audio tag same as for video u have to use it inside of video tag!