How to make one restart screen for an entire game

I have a separate restart screen with a restart button and a quit button, I want to make it so that the restart button just reloads the last played level and I want to be able to do this for every level of the game

I’ve tried this code but it did not work

public class Restart : MonoBehaviour {

	void OnMouseDown()
	{
		Application.LoadLevel(Application.loadedLevel); 
	}
}

I am pretty sure this does not work because when the player dies it opens up a new scene (the restart scene) and the loadedlevel just reloads the restart scene, so how would i reload the previous scene?

i have an idea, create a gameobject put it in the scene atach a script with this code:

 public int currentLevel;

void Start()
{
currentLevel = Application.LoadedLevel;


}

void Awake()
{
 DontDestroyOnLoad(this);
}