Redirection chain and Javascript Redirect
-
Hi,
A redirection chain is usually defined as a page redirecting to another page which itself is another redirection.
URL1 ---(301/302)---> URL2 ---(301/302)---> URL3
But what about Javascript redirect? They seem to be a different beast:
URL1 ---(301/302)---> URL2 ---(200 then Javascript redirect)---> URL3
From what I know if the javascript redirect is instant Google counts it as a 301 permanent redirection, but I'm still not sure about if this counts as a redirection chain.
Most of the tools (such as moz) only see the first redirection.
So is that scenario a redirection chain or no?
-
It's a delicate balance between efficient routing and ensuring seamless transitions, where every decision shapes the user's path and perception. myvirtualworkplace
-
@LouisPortier said in Redirection chain and Javascript Redirect:
Hi,
A redirection chain is usually defined as a page redirecting to another page which itself is another redirection.
URL1 ---(301/302)---> URL2 ---(301/302)---> URL3
But what about Javascript redirect? They seem to be a different beast:
URL1 ---(301/302)---> URL2 ---(200 then Javascript redirect)---> URL3
From what I know if the javascript redirect is instant Google counts it as a 301 permanent redirection, but I'm still not sure about if this counts as a redirection chain.
Most of the tools (such as moz) only see the first redirection.
So is that scenario a redirection chain or no?
A JavaScript redirect, on the other hand, is a redirect that occurs using JavaScript code embedded in a webpage. Instead of relying on server-side redirects, JavaScript redirects are triggered when the page loads or when certain conditions are met, and they instruct the browser to navigate to a different URL. They can be used for various purposes, such as redirecting users after a certain amount of time, after a form submission, or based on user interactions.
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
I appreciate your detailed explanation. To enhance accuracy in tracing redirects, ensure a cohesive sequence. Consider using a unified approach for hash numbers, perhaps generating a unique identifier for each transition. Additionally, refine the code logic to account for different redirection techniques, ensuring a seamless and connected mapping of the entire journey from A to D. If possible, share snippets of your code for more targeted guidance. shopify website design servicee austin
-
Thank you for the valuable feedback. While the current code successfully executes, it lacks accuracy in tracing the redirect sequence. The issue stems from the disjointed nature of the captured redirects, as seen in the isolated transitions from A to B, B to C, and C to D, where randomly generated hash numbers (channel_1 and channel_2) are utilized. This disrupts the continuity of the redirect chain, resulting in an inaccurate representation of the actual progression from A through D.
The objective is to effectively track the entire journey, encompassing transitions from A to B to C to D, across various redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. I would greatly appreciate your guidance on refining the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process. Liteblue
-
Thank you for the valuable feedback. While the current code successfully executes, it lacks accuracy in tracing the redirect sequence. The issue stems from the disjointed nature of the captured redirects, as seen in the isolated transitions from A to B, B to C, and C to D, where randomly generated hash numbers (channel_1 and channel_2) are utilized. This disrupts the continuity of the redirect chain, resulting in an inaccurate representation of the actual progression from A through D.
The objective is to effectively track the entire journey, encompassing transitions from A to B to C to D, across various redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. I would greatly appreciate your guidance on refining the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process. Liteblue
-
In the scenario you described, where there is a sequence of redirects involving both HTTP redirects (301/302) and a JavaScript redirect, it can be considered a redirection chain. The key point is that each step in the sequence contributes to the final destination of the URL.
In your example:
- URL1 redirects to URL2 using an HTTP 301/302 status code.
- URL2, after an HTTP 200 response, triggers a JavaScript redirect to URL3.
From Google's perspective, if the JavaScript redirect is instantaneous and does not introduce a delay, it might treat it similarly to a traditional 301 permanent redirect. However, it's important to note that search engines may interpret JavaScript redirects differently, and their behavior may evolve over time.
Tools like Moz may sometimes focus on the initial HTTP redirect and not delve into subsequent steps, potentially overlooking the complete redirection chain. Therefore, discrepancies in what different tools report could occur.
For a more comprehensive understanding, you might consider using tools or methods that specifically analyze JavaScript-based redirects or inspect the network requests in a browser's developer tools to see the entire redirection sequence. This way, you can get a clearer picture of how search engines and various tools interpret the entire redirection chain, including both HTTP and JavaScript redirects.
-
Thank you for the insightful feedback. While the current code executes successfully, it falls short in accurately tracing the redirect sequence. The issue lies in the disjoint nature of the captured redirects, exemplified by the isolated transitions A->B, B->C, and C->D, where the hash numbers (channel_1 and channel_2) are generated randomly. This disrupts the continuity of the redirect chain, failing to reflect the actual progression from A through D. The goal is to effectively track the entire journey, A->B->C->D, across different redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. Could you provide guidance on how to refine the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process?
-
Thank you for the insightful feedback. While the current code executes successfully, it falls short in accurately tracing the redirect sequence. The issue lies in the disjoint nature of the captured redirects, exemplified by the isolated transitions A->B, B->C, and C->D, where the hash numbers (channel_1 and channel_2) are generated randomly. This disrupts the continuity of the redirect chain, failing to reflect the actual progression from A through D. The goal is to effectively track the entire journey, A->B->C->D, across different redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. Could you provide guidance on how to refine the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process? Liteblue
-
Thank you for your feedback. While the code is currently functional, it doesn't yield the expected outcome. The recorded redirect chain appears disjointed, capturing transitions like A->B (channel_1 -> channel_2), B->C (channel_1 -> channel_2), and C->D (channel_1 -> channel_2). The issue lies in the randomly generated hash numbers (channel_1 and channel_2), preventing the proper linkage of the redirect chain. The goal is to accurately capture sequential events such as A->B->C->D, considering various redirection methods like meta-refresh, JavaScript, and HTTP. How can I modify the code to implement this strategy and ensure the redirection chain is connected as intended?
-
Thank you for your feedback. Although the code is functional, it does not produce the expected result. Currently, the recorded redirect chain is disjointed, capturing transitions like A->B (channel_1 -> channel_2), B->C (channel_1 -> channel_2), and C->D (channel_1 -> channel_2). In this case, the hash numbers (channel_1 and channel_2) are randomly generated, preventing the proper linking of the redirect chain. The objective is to accurately capture the sequential events of A->B->C->D, considering various redirection methods such as meta-refresh, JavaScript, and HTTP. How can I modify the code to achieve this strategy and ensure the redirection chain is connected as intended? Liteblue
-
thx, the code works, but not as expected: A->B->C->D (channel_1 -> channel_2 -> channel_3 -> channel_4).
In my case it will record a redirect chain of A->B->C->D like:
A->B (channel_1 -> channel_2), than B->C (channel_1 -> channel_2), C->D (channel_1 -> channel_2); where channel_1 & channel_2 are random hash numbers.
So I can not link the chain together. that would be the strategy to capture the chain of events (while the pages redirect using, meta-refresh, javascript, http...)? Liteblue USPS
-
window.location.replace('http://example.com');
It's better than using window.location.href = 'http://example.com';
Using replace() is better because it does not keep the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco.
If you want to simulate someone clicking on a link, use window.location.href
If you want to simulate an HTTP redirect, use window.location.replace
You can use assign() and replace methods also to javascript redirect to other pages like the following:
location.assign("http://example.com");
The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the "back" button to navigate back to the original document. So Use the assign() method if you want to load a new document, andwant to give the option to navigate back to the original document.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
301 Redirects
Looking for the best way to do the following. Business has changed its name, and has also become a corporate store. The old domain name is now no longer needed as a website page has been created inside the main corporate site. Obviously i dont want to loose all the traffic that we had and want to redirect them but there is a problem, that im unable to redirect the old domain to the new one due to office 365 installed on the hosting platform, and the old emails will need to run for another 6 months. I can remove the old site and put a landing page up, but i still need to redirect all the pages to the new site, and there is approx 50+ of them. My main question is i currently have atleast 50+ redirects already in there due to seo changes over the years, some would go back atleast 5 years, whats a safe amount of time that i can remove the older redirects And am i going about this the right way so i dont loose all the hard work on rankings etc
Technical SEO | | Dunjoko0 -
Fundamental HTTP to HTTPS Redirect Question
Hi All I'm planning a http to https migration for a site with over 500 pages. The site content and structure will be staying the same, this is simply a https migration. Can I just confirm the answer to this fundamental question? From my reading, I do not need to create 301 redirect for each and every page, but can add a single generic redirect so that all http references are redirected to https. Can I just double check this would suffice to preserve existing google rankings? Many Thanks
Technical SEO | | ruislip180 -
Remove a page after redirection
Hi, I had page eg. www.example.com/page1 and I redirect 302 it to > www.example.com/page2 After that I fatch this page (page2) with GSC and this page was index in serp. Can I remove this old redirect page > www.example.com/page1 now? Will this remove harm my page?
Technical SEO | | Tormar0 -
301 Redirects
Hello, All. Hopefully this will be an easy question for some of you. I have a (WordPress) site with the format of: http://www.site.com/folder-old/page-old/ I have since re-named both the parent and sub-folders to (example): http://www.site.com/folder-new/page-new/ Everything is working well EXCEPT I am also trying to redirect visitors from the old URL/structure to the new. I have a 301 redirect setup as the following: Redirect 301 /folder-old/page-old/ http://www.site.com/folder-new/page-new/ -- But it doesn't seem to be working. Not sure if this is something finicky with WordPress or if the redirect is incorrect. Thank you.
Technical SEO | | BrandBuilder0 -
URL Changes And Site Map Redirects
We are working on a site redesign which will change/shorten our url structure. The primary domain will remain the same however most of the other urls on the site are getting much simpler. My question is how should this be best handled when it comes to sitemaps because there are massive amounts of URLS that will be redirected to the new shorter URL how should we best handle our sitemaps? Should a new sitemap be submitted right at launch? and the old sitemap removed later. I know that Google does not like having redirects in sitemaps. Has anyone done this on a large scale, 60k URLs or more and have any advice?
Technical SEO | | RMATVMC0 -
60% Internal Redirects
A new client I am working with has a site with over 9,000 internal 301 redirects. These are as a result of old links not being updated and the number of internal 301 redirects far outweighs the number of 'correct' links on the site. My personal opinion is that creates the risk of crawl errors/issues and whilst a 301 redirect is correct in this case, it does not negate the need to update internal links. The problem I have is that when I explain this to the client, they reply with an Matt Cutts video from 2008 that talks about 301 redirects being correct for site migrations. Even though the video is not entirely relevant to the point, I can not get the client to move from his position. Ideally, what I am looking for help with is the following: Am I right in my position that having this many redirects is a potential issue and that internal links should be updated? Does anyone know of any articles from 'notable/reputable' sources that I can use in order to support my position? Thanks in advance for your help.
Technical SEO | | MattHopkins0 -
Temporary redirects
why is wordpress creating redirects from trackbacks and what can i do about it? according to seomoz i have several of these kinds of temporary redirects: http://redlandsorthodontics.com/about-us-2/meet-the-staff/redlands-orthodontics/trackback/ redirects to http://redlandsorthodontics.com/about-us-2 what are trackbacks anyway since i didn't purposely create them?
Technical SEO | | dad7more0 -
Can Google read text in Javascript?
We have just completed the redesign of our product page, which you can see here: http://www.uksoccershop.com/p-19045/2011-12-Chelsea-Adidas-Away-Football-Shirt.html Because we want the select size / add to basket section to appear prominently, you can see we are showing only a snippet of the product description in this section and then user has to click "more" to see it. My question is, can Google read the product description here since it's in Javascript? The code is as follows: 2011-12 Chelsea Adidas Away Football Shirt £44.99 Item Code:379606 Brand new, official Chelsea away shirt for the 2011/12 Premiership season, available to buy in adult sizes S, M, L, XL, XXL, XXXL. This football shirt is manufactured by Adidas and is black in colour.[ More...](javascript:void(0);) Brand new, official Chelsea away shirt for the 2011/12 Premiership season, available to buy in adult sizes S, M, L, XL, XXL, XXXL. This football shirt is manufactured by Adidas and is black in colour. Cheer on the Blues in style in the new adidas Chelsea Away Shirt, featuring a striking blue blocked design on an imposing black background complete with the club crest and adidas logo embroidery across the chest for a great style on or off the pitch. The new Chelsea Away Shirt is designed with adidas' ClimaCool technology to bring moisture away from your skin, keeping you cool, comfortable and performing at your best as you emulate the skills of Frank Lampard, Fernando Torres and John Terry on the pitch. Customise your shirt with Premiership shirt printing for your favourite Chelsea stars or choose your own custom name and number. Adult Football Shirt
Technical SEO | | ukss1984
Short sleeves soccer jersey
Chelsea club crest to left chest
adidas logo and stripes
Print sponsor to centre
ClimaCool technology
Machine washable Product code: 379606 The 2011/12 Chelsea away football kit is released on 7th July 2011. <form name="currenychange" action="http://www.uksoccershop.com/p-19045/2011-12-Chelsea-Adidas-Away-Football-Shirt.html" method="get">
<select class="topselectbox" onchange="this.form.submit();" name="currency" style="float:right;"> <option value="USD">US Dollars</option> <option value="EUR">Euro</option> <option value="GBP" selected="selected">UK Sterling</option> <option value="AUD">Australian Dollars</option> </select>
</form> Available Now [Be the first to ask a question](javascript:void(0); "Ask a Question")
[Be the first to review this product](javascript://) Rating: 5 out of 5 stars <form name="cart_quantity" action="http://www.uksoccershop.com/p-19045/2011-12-Chelsea-Adidas-Away-Football-Shirt.html?number_of_uploads=0&action=add_product" method="post" enctype="multipart/form-data"> Which parts of this is Google going to be able to read? Should we make the product title our H1 header for this page and can it currently read that within the code above? </form>0