I have a page where a <button>
is kept on which onClick()
event fires and redirects the new page in new tab. Meanwhile I want the parent page to close itself as soon as the <button>
is clicked with opening the new page in new tab. Its basically for some security feature for the website. How can this be done?
Here is my <button>
, let me know where can i correct myself.
<button formtarget="_blank" type="submit" name="submit" onClick="javascript:window.open('quiz.php?unit_id=<?php echo $fnc->encode($unit_id) ; ?>');self.close();" value="submit" class="btn btn-info" style='margin-left: 35%;margin-bottom: 10px;' ><i class="glyphicon"></i> Start Quiz</button>