javascript - redirect when download is initiated -


The page should be redirected after the start of the download, but I have a code like whether the download is started or not , It is being redirected later. SetTimeout is a solution so that we can start a download or write a condition after the completion, we can redirect to the desired page. Thanks in advance ..

  & lt ;? Php while ($ row1 = mysql_fetch_array ($ result)) {$ name = $ row1 ['name']; $ Type = $ ROW1 ['type']; ? & Gt; & Lt; Div class = "rect" id = "d1" & gt; & Lt; Img alt = "bottom-icon" src = "down-drop-icon" align = "left" width = "20" height = "20" /> & Lt; A href = "download.php? Filename = & lt ;? php echo $ name; & gt;" & Gt; & Lt ;? Php echo $ name ;? & Gt; & Lt; / A & gt; & Lt; Script type = "text / javascript" & gt; Var howLongToWait = 15; // var urlOfRedirectLocation Number of seconds to wait = 'http://gomasti.in/p/gomasti/'; Function startRedirect () {window.top.location.href = urlOfRedirect location; } SetTimeout ('startRedirect ()', howLongToWait * 1000); & Lt; / Script & gt; & Lt; / Div & gt; & Lt ;? Php}? & Gt;    

When you click on the link, you want to activate the timer: < / P>

  & lt; A href = "download.php? Filename = & lt ;? php echo $ name; & gt;" Onclick = "setTimeout ('startrirectirect)', howLongToWait * 1000);" & Gt; & Lt ;? Php echo $ name ;? & Gt; & Lt; / A & gt;   

while looping & lt; Script & gt; should be the code, define the function and variable only once.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -