Nikolaus
Nikolaus

Reputation: 253

How to prevent automatic starting function after webpage is loaded?

I used this simple recorder for recording my voice: A plugin for recording/exporting the output of Web Audio API nodes

I want to implement it to my webpage. This recording example is set to ask user for allowing microphone immediatelly when page is loaded, but I want to show this message after clicking on button record, so when user want to use this service. Also there are shown "logs", they are shown also when page is loaded. I want also to show logs after clicking on button. I think it is logical, so when user want to use recorder he is informed about this service.

Upvotes: 0

Views: 52

Answers (1)

slash197
slash197

Reputation: 9034

Remove executing the init function on window onload event and simply call it when needed.

Instead of

window.onload = function init() {...}

Have

function init() {...}

And

<button onclick="init()">Record</button>

Upvotes: 3

Related Questions