开发者

Redirect to new blog using jquery or javascript

开发者 https://www.devze.com 2022-12-11 22:27 出处:网络
I closed my old blog so I redirect our old blog to our new blog but if any user comes from the old blog then he can\'t watch our video in our blog..

I closed my old blog so I redirect our old blog to our new blog but if any user comes from the old blog then he can't watch our video in our blog.. i used

<script language="javascript" type="text/javascript">
    window.onload = function java() {
        window.location = "http://anirudhagupta.blogspot.com";
    }

</script>

But he redirect like a ajax so Silverlight video object is not worked so how can i 开发者_C百科solve it using jquery or javascript


Don't do JS redirects. This is the worst possible option. JS redirects are not reliable (what if the user has diasbled JS?), they break browser history behavior and they have much better and correct alternatives.

Prefereably, use one of these:

  • Server-side HTTP redirect (code 301)
  • <meta> redirect (such as: <meta http-equiv="REFRESH" content="0;url=http://www.new-domain.com">)


you shoulnd't use javascript to redirect to your new blog. there are better ways to do this (ie. 301 permanent redirect). anyway, the issue with videos is not related to the redirect.


just this should do the trick ( if you are using jQuery )


   $(document).ready(function() {
     window.location.href="http://anirudhagupta.blogspot.com"
   })


The code you've posted is not an AJAX redirect (which really doesn't exist, anyway). That Javascript redirect works fine for me. I don't see any Flash on your page, but the Silverlight is working fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消