while(true){
window.setTimeout(function() {
myMethod()
}, 15000);
}
function myMethod() {
alert(\"repeat\
but once I run the code my browser hangs
it will because you are endlessly creating setTimeout()
requests by doing while(true) since it will not wait for 15 secs
before doing next iteration of while
if you want to keep alerting something every 15 sec then try
window.setTimeout( myMethod, 15000);
function myMethod()
{
alert("repeat");
window.setTimeout( myMethod, 15000);
}