Patch #13697

Back-button on diff page is not working when I'm directed from email

Added by Filou Centrinov over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:2.4.0

Description

Situation:
I get an email from Redmine with a diff-link to the changed description of an issue. I click on that link in my email to get informed about changed details.

Problem:
When I click now on the back-link on the diff page, nothing happends.

Reason:
The back-link tries to get the page I've been before (history.back()), but there not such a page.

I fixed this problem with a patch.

diff.html.erb.patch Magnifier (602 Bytes) Filou Centrinov, 2013-04-05 18:57

Associated revisions

Revision 11893
Added by Toshi MARUYAMA over 4 years ago

fix back-button on description diff page in case of no browser history (#13697)

Contributed by Filou Centrinov.

Revision 11900
Added by Toshi MARUYAMA over 4 years ago

use document.referrer instead of history.length (#13697)

Contributed by Filou Centrinov.

History

#1 Updated by Filou Centrinov over 4 years ago

  • Description updated (diff)

Woudn't you agree to apply this patch? Otherwise I can't go from a diff page to its issue page.

#2 Updated by Toshi MARUYAMA over 4 years ago

  • Status changed from New to Closed
  • Target version set to 2.4.0

Committed in trunk r11893, thanks.

#3 Updated by Filou Centrinov over 4 years ago

  • Status changed from Closed to Reopened

The problem is, that browsers handle history.length differently: http://www.w3schools.com/jsref/prop_his_length.asp

I would suggest the following code, tested on Firefox, IE and Opera:

history.back(); return (document.referrer=="");
or
if (document.referrer!="") {history.back(); return false;}

I tested it like this: history.back(); alert((document.referrer=="")); return (document.referrer=="");

#4 Updated by Toshi MARUYAMA over 4 years ago

  • Status changed from Reopened to Closed

Committed in trunk r11900, thanks.

Also available in: Atom PDF