I need to click on the button on the previous screen by clicking on the button at the current screen
Writing method for clicking on the current button screen is easy (see below) but I have troubles finding the button on the previous screen.
$('body.printing').prepend('<input type="button" value="Retry" id="RetryLetter"/>');
$("#RetryLetter").click(function()
{
// parent.history.back().$("#printLetter").click();
var prButton = document.referrer.getElementById("printLetter");
prButton.click();
// window.opener.$("#printLetter").click();
});
I tried several variants – so far nothing worked
document.referrer is just a string with the referring URL. It is not a DOM element that you can access.
http://wap.w3schools.com/jsref/tryit.asp?filename=tryjsref_doc_referrer