You're right on what those different snippets do. As to WHEN they should be used, that's going to depend on the need. If you want to redirect the user back where they came from, use the first option. If you need to redirect them to a new location OR simply refresh the current page, use the 2nd option. Regarding the JS snippet, though, I would urge you to not rely on that, especially since the same thing can be accomplished with standard functions.
Example: You need to build a "Submit" button that selects a checkbox, captures the current date & time, captures the current User, and then simply refreshes the page. Instead of using JS, the native formula could be done like this:
var text chk = "&_FID_68=" & "1";
var text usr = "&_FID_65=" & URLEncode(User());
var text time = "&_FID_65=" & URLEncode(Now());
var text tk = "token";
var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=" & $tk & "&rid=" & [Record ID#] &
$chk &
$time &
$usr &
"&rdr=" ;
var text Land = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];
"<a class='Vibrant Success' & href=" &
$url &
URLEncode($land)
& ">Submit</a>"
------------------------------
Blake Harrison
bharrison@datablender.io
DataBlender - Quick Base Solution Provider
Atlanta GA
404.800.1702 /
http://datablender.io/------------------------------