{"id":30321,"date":"2014-05-14T08:43:22","date_gmt":"2014-05-14T13:43:22","guid":{"rendered":"http:\/\/webirix.com\/?p=30321"},"modified":"2014-05-14T08:43:22","modified_gmt":"2014-05-14T13:43:22","slug":"javascript-regresar-recargando-la-pagina","status":"publish","type":"post","link":"https:\/\/webirix.com\/en\/javascript-regresar-recargando-la-pagina\/","title":{"rendered":"Javascript. Return reloading the page"},"content":{"rendered":"<p style=\"color: #222222;\">JavaScript is a language that has become very important with the new version of\u00a0<strong>HTML5<\/strong>. Its uses are very varied and now we will see\u00a0<strong>how to return to the previous page by reloading it<\/strong>.<\/p>\n<p style=\"color: #222222;\">When we use the function<strong>\u00a0back ()<\/strong>\u00a0from\u00a0<strong>JavaScript<\/strong>, we return to the previous website, but this one does not reload. This is a problem when we have come to this website from a form with a POST method, since the form data has to be sent again.<\/p>\n<p style=\"color: #222222;\">On this occasion, we will get an error of the type:<\/p>\n<p style=\"color: #222222;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2204\" src=\"http:\/\/www.galisteocantero.com\/wp-content\/uploads\/2014\/04\/error-regresar-form.jpg\" alt=\"error regresar formulario\" width=\"100%\" \/><\/p>\n<p style=\"color: #222222;\">\n<p style=\"color: #222222;\">So that these types of errors do not occur, we have to return to said website by reloading it and therefore sending the form data again.<\/p>\n<p style=\"color: #222222;\">We will do this by specifying in the attribute\u00a0<strong>href<\/strong>\u00a0from the label to the next value<\/p>\n<div class=\"wp_syntax\" style=\"color: #222222;\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"php\"><span style=\"color: #339933;\">&lt;<\/span> to href <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">&quot;window.location = document.referrer;&quot;<\/span> <span style=\"color: #339933;\">&gt;<\/span> To return <span style=\"color: #339933;\">&lt;<\/span> <span style=\"color: #339933;\">\/<\/span> to <span style=\"color: #339933;\">&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"color: #222222;\">The value<\/p>\n<div class=\"wp_syntax\" style=\"color: #222222;\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"php\">window<span style=\"color: #339933;\">.<\/span>location <span style=\"color: #339933;\">=<\/span> document<span style=\"color: #339933;\">.<\/span>referrer<span style=\"color: #339933;\">;<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"color: #222222;\">It takes care of returning to the previous page and avoiding the error of resending the form.<\/p>","protected":false},"excerpt":{"rendered":"<p>JavaScript is a language that has become very important with the new version of HTML5. Its uses are very varied and now we will see how to return to the previous page by reloading it. When we use the back () function of JavaScript, we return to the previous web, but this one does not reload. This is a problem when we have come to this website from a form ...<\/p>","protected":false},"author":2,"featured_media":30322,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2014],"tags":[2029],"class_list":["post-30321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programacionweb","tag-javascript"],"jetpack_featured_media_url":"https:\/\/webirix.com\/wp-content\/uploads\/2014\/05\/descarga.jpg","_links":{"self":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts\/30321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/comments?post=30321"}],"version-history":[{"count":1,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts\/30321\/revisions"}],"predecessor-version":[{"id":30323,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts\/30321\/revisions\/30323"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/media\/30322"}],"wp:attachment":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/media?parent=30321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/categories?post=30321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/tags?post=30321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}