{"id":51709,"date":"2021-02-20T03:01:50","date_gmt":"2021-02-19T17:01:50","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=51709"},"modified":"2021-02-20T06:13:09","modified_gmt":"2021-02-19T20:13:09","slug":"webpage-vertical-position-return-content-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/webpage-vertical-position-return-content-tutorial\/","title":{"rendered":"Webpage Vertical Position Return Content Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=Webpage Vertical Position Return Content Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start_content.jpg\" title=\"Webpage Vertical Position Return Content Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Webpage Vertical Position Return Content Tutorial<\/p><\/div>\n<p>The improvement, today, onto yesterday&#8217;s <a title='Webpage Vertical Position Return Tutorial' href='#wvprt'>Webpage Vertical Position Return Tutorial<\/a> is, nominally, to allow the user to specify what their table cell wording should be, as a comma separated string entered via a Javascript prompt window and accessed via a minus sign &#8220;a&#8221; link in amongst the header elements.<\/p>\n<p>Along the way, we realized a thing about returns to the same web application using the same web browser previously used.  The nature of the web application with its scrolling will cause autocompletion at the web browser address bar to &#8230;<\/p>\n<p><code>HTTP:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html#lime<\/code><\/p>\n<p> &#8230; or something similar.  Within the web application this causes &#8220;location.hash&#8221; to get a value, and the implication of this is that for the working of the web application, including going off to external links and arriving back appropriately positioned, via that external webpage&#8217;s back button\/link we need to differentiate &#8230;<\/p>\n<ul>\n<li>a web browser address bar entry such as &#8230;<br \/>\n<code>HTTP:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html#maroon<\/code><br \/>\n &#8230; as you first enter the web application from nowhere (ie. above is typed or copied into the web browser address bar and you act to navigate to that URL (with location.hash defined)) &#8230; as distinct from &#8230;<\/li>\n<li>a web browser address bar entry such as &#8230;<br \/>\n<code>HTTP:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html#maroon<\/code><br \/>\n &#8230; as you return to the web application via one of those external webpage back button\/link<\/li>\n<\/ul>\n<p>What might help, at the client level or server level (as our web application is serverside PHP)?  Well, at client level there is &#8230;<\/p>\n<p><code>document.referrer<\/code><\/p>\n<p> &#8230; which is a client (ie. seen by Javascript) data item that contains a URL of a webpage navigated from or nothing\/blank\/null when you navigated to the webpage from the web browser address bar directly &#8230;<\/p>\n<p><code><br \/>\n\/\/ initialization of global variable<br \/>\n   var documentreferrer=('' + document.referrer);<br \/>\n<br \/>\n\/\/ document.body <font color=blue>part of<\/font> onload event logic ...<br \/>\n   function onl() {<br \/>\n     var ourrect;<br \/>\n     <font color=blue>if (('' + location.hash) != '' && ('' + documentreferrer) == '') {<br \/>\n       location.href=document.URL.split('#')[0];<br \/>\n     }<\/font><br \/>\n     for (var ii=0; ii<zcgcols.length; ii++) {  \n       document.getElementById('mytable').innerHTML+=\"&lt;tr&gt;&lt;td class=big onscroll='checkscroll(this);' onmousewheel='checkscroll(this);' id=\" + zcgcols[ii].replace(\/\\ \/g,'-') + \" style='text-align:center;vertical-align:middle;width:100%;height:400px;\" + bordstr + \"background-color:\" + cgcols[eval(ii % cgcols.length)] + \";'&gt;&lt;a onclick=\\\"settd(document.getElementById('s\" + zcgcols[ii].replace(\/\\ \/g,'-') + \"'));\\\" style='background-color:white;padding: 5 5 5 5;' href='\/\/wikipedia.org\/wiki\/\" + zcgcols[ii].replace(\/\\ \/g,'-') + \"'&gt;\"  + zcgcols[ii] + \"&lt;\/a&gt;&lt;\/td&gt;&lt;\/tr&gt;\";     \n       document.getElementById('rhs').innerHTML+=\"&lt;tr&gt;&lt;td onclick='settd(this);' class=small id=s\" + zcgcols[ii].replace(\/\\ \/g,'-') + \" style='text-align:center;width:100%;height:40px;\" + bordstr + \"background-color:\" + cgcols[eval(ii % cgcols.length)] + \";'&gt;\" + zcgcols[ii] + \"&lt;\/td&gt;&lt;\/tr&gt;\";     \n       bordstr=\"\";\n     }\n     var ourbigs=document.getElementsByTagName('td');\n     for (var iii=0; iii<ourbigs.length; iii++) {\n       if (('' + ourbigs[iii].className) == 'big') {\n         bigs.push(ourbigs[iii].getBoundingClientRect());\n       }\n     }\n     <font color=blue>documentreferrer='x';<\/font><br \/>\n\/\/ rest of onload logic<br \/>\n   }<br \/>\n<\/code><\/p>\n<p>In that last scenario we actually check for this via a filled in &#8220;location.hash&#8221; value and redirect to a URL with no hash part so that <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html-GETME\" title=\"returning_to_start.html\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html-GETME\" title=\"returning_to_start.html\">second draft &#8220;proof of concept&#8221;<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html\" title=\"Click picture\">live run<\/a> you can also try for yourself.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/webpage-vertical-position-return-content-tutorial\/'>Webpage Vertical Position Return Content Tutorial<\/a>.<\/p-->\n<hr>\n<p id='wvprt'>Previous relevant <a target=_blank title='Webpage Vertical Position Return Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/webpage-vertical-position-return-tutorial\/'>Webpage Vertical Position Return Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=Webpage Vertical Position Return Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.gif\" title=\"Webpage Vertical Position Return Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Webpage Vertical Position Return Tutorial<\/p><\/div>\n<p>We have a very simple &#8220;proof of concept&#8221; web application to present today.  The reason for our &#8220;webpage position return&#8221; idea centres around four concepts &#8230;<\/li>\n<table>\n<tr>\n<th>Today we &#8230;<\/th>\n<th>Whereas usually we &#8230;<\/th>\n<\/tr>\n<tr>\n<td>\n<ul>\n<li>&#8220;a&#8221; link navigation that is target=_self (ie. default navigation that stays on the same web browser tab clobbering content)<\/li>\n<li>webpage vertical scrolling of content to &#8220;below the fold&#8221;<\/li>\n<li>hashtag # navigation<\/li>\n<li>use of web browser back link\/button<\/li>\n<\/ul>\n<\/td>\n<td>\n<ul>\n<li>&#8220;a&#8221; link navigation that is target=_blank (ie. to a new web browser tab leaving original webpage unaffected)<\/li>\n<li>try for &#8220;no webpage vertical scrolling of content required&#8221;<\/li>\n<li>try for &#8220;no need for hashtag # navigation&#8221;<\/li>\n<li>try for &#8220;no need for use of web browser back link\/button&#8221;<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/table>\n<p>So what happens if no hashtag # navigation happens ahead of navigating to a new webpage via an &#8220;a&#8221; link set to target=_self?  It will, unless catered for (and there is a mix out there), will return back to that previous webpage at its topmost positioning (as far as vertical scrolling goes).   The internal hashtag # navigation concerns taken in our proof of concept allows the return to be either exactly, or nearly, returned to &#8230;<\/p>\n<ul>\n<li>the appropriate webpage &#8230; doh! &#8230;<\/li>\n<li>at an apt vertical scrolling position<\/li>\n<\/ul>\n<p>See what we mean, and what we are talking about with <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html_GETME\" title=\"returning_to_start.html\">our first draft &#8220;proof of concept&#8221;<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html\" title=\"Click picture\">live run<\/a> you can also try below &#8230;<\/p>\n<p><iframe src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/returning_to_start.html\" style=\"width:100%;height:800px;\"><\/iframe><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d51696' onclick='var dv=document.getElementById(\"d51696\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/navigation\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d51696' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d51709' onclick='var dv=document.getElementById(\"d51709\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/hashtag\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d51709' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The improvement, today, onto yesterday&#8217;s Webpage Vertical Position Return Tutorial is, nominally, to allow the user to specify what their table cell wording should be, as a comma separated string entered via a Javascript prompt window and accessed via a &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/webpage-vertical-position-return-content-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[3566,123,257,3013,557,576,652,1807,830,997,1761,1107,2001,3565,1319,3332,1418],"class_list":["post-51709","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-back","tag-back-button","tag-content","tag-document-referrer","tag-hashtag","tag-html","tag-javascript","tag-link","tag-navigation","tag-programming","tag-prompt","tag-scrolling","tag-tab","tag-target","tag-tutorial","tag-vertical-scrolling","tag-webpage"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51709"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=51709"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51709\/revisions"}],"predecessor-version":[{"id":51728,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51709\/revisions\/51728"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=51709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=51709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=51709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}