Showing posts with label php and javascript. Show all posts
Showing posts with label php and javascript. Show all posts

Go back to previous page using javascript

If you like to enable your visitors to go back to the previous page by clicking back button in your websites. use this code

Copy and paste this code into your HTML
<form>
<input type="button" value="Back to Previous Page" onClick="javascript: history.go(-1)">
</form>

Go Back to previous page with a simple link

<a href="javascript: history.go(-1)">Back</a>

How to redirect a Page Using Javascript in php

If you don't like using header() as I like to redirect page mid-page. This is implemented using
Javascript written through PHP function. Has a die() function at the end for people who has
disabled their Javascript in their browser.

<?php
function redirect($new_location){
   echo ("<script type='text/javascript'>
   document.location.replace('$new_location');
   </script> ");
   die();
}
?>
Related Posts Plugin for WordPress, Blogger...