Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Bootstrap Cannot modify header information

I try to do a notification system , that play a sound each time some one make a new post. I am work in boostrap 4 I have chnge the way to do it by insert a javascript in the functions page but wen i call the javascript function give me all ways the same error of before I go to post only part of all the code because is dimention The sctipt i call is play_sound and i call in an echo like this

echo '<script type="text/javascript">play_sound();</script>';

and i get same error then before

This is my error

Warning: Cannot modify header information - headers already sent by (output started at /home/nicetaxi/public_html/helpers/Functions.php:1) in /home/nicetaxi/public_html/helpers/Functions.php on line 208

This is the line of my error

function redirect_to_page($path = null)
{
header("location:" . SITE_ADDR . $path);
}

How can i solve this error

This is the functions page

<script type="text/javascript">
function play_sound() {
    var audioElement = document.createElement('audio');
    audioElement.setAttribute('src', 'https://www.nicetaxi.eu/download/notifications.mp3');
    audioElement.setAttribute('autoplay', 'autoplay');
audioElement.setAttribute('muted', 'muted');
    audioElement.load();
    audioElement.play();
}
</script>
<?php
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Avoid echo statement before header(), triggers "Header has already been sent out error". If the echo is mandatory to use

Use javascript redirect instead window.location.href = 'url; //Will take you to url.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!