jquery - Page Switcher using the url (javascript) -


is possible switch pages depending on url using javascript?

i working on large scale site requires switcher added users can switch between specific market sites depending if page viewing available on other market.

what want able give user option view same page on market , if page not exist e.g. 400 page redirect specific markets homepage.

does know if functionality possible using javascript?

kind regards,

b

so, want link checker basically, checks if "page" on other market valid (does not redirect homepage), , give user option go page if valid?

i suppose done using ajax. attempt follow link using ajax, , if response of homepage, don't show link, otherwise show link.

in jquery (roughly):

$.ajax({  url:[your link],  datatype:'html',  success: function(html){   if($(html).find("body.homepage").length == 0)     alert('link good');   else    alert('link bad');  } }); 

you might able in way catch 301/302 status redirect, more efficient. but, i'm not sure how set up. tell not redirect ajax call, , 301/302 show error, check status 301/302.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -