简体   繁体   English

JQuery / JavaScript的域重定向问题

[英]Domain redirect problem with JQuery/JavaScript

I got a strange problem. 我有一个奇怪的问题。 I have a fullscreen image scaler javascript (as GOTOCHINA website) that works very well on my website. 我有一个全屏图像缩放器javascript(作为GOTOCHINA网站),在我的网站上效果很好。

Then, I purchased a domain redirect pointing on my website and when redirecting suddenly internet explorer 7 and internet explorer 8 give me this error 然后,我购买了指向我网站上的域重定向,当突然重定向时,Internet Explorer 7和Internet Explorer 8给我这个错误

Messagge: is not a valid argument. Messagge:不是有效的参数。
Line: 34 行:34
Char: 17 字符:17
URI: http://***********/scaler.js URI:http://***********/scaler.js

The script is 该脚本是

var db=document.body;
var imag=document.getElementById('wallpaper');
 var dbsize={};
 var imgsrc=imag.src; 
 var keyStop=function(e){
  var e=window.event||e||{};
  var tag=e.target.tagName.toLowerCase();
  if(tag!='textarea'&&!(tag=='input'&&(e.target.type=='text'||e.target.type=='password'))){ 
   if(e.keyCode==32||e.keyCode==39||e.keyCode==40){ 
    if(e.preventDefault)e.preventDefault();
    else e.returnValue=false;
   }
  }
 }
 if(this.addEventListener)window.addEventListener('keydown',keyStop,false);
 else window.attachEvent('onkeydown',keyStop);

setInterval(function(){
  window.scrollTo(0,0);
  if(imag.complete){ 
   if(db.clientWidth!=dbsize.w||db.clientHeight!=dbsize.h||imag.src!=imgsrc){ 
    imgsrc=imag.src; 
    var dbsizew=db.clientWidth; 
    var dbsizeh=db.clientHeight; 
    var newwidth=Math.round(dbsizeh*(imag.offsetWidth/imag.offsetHeight)); 
                var nextvar=dbsizew>newwidth?dbsizew:newwidth;
                imag.style.width=nextvar+'px';

   }
  }
 },300);

In other words when i open the official website everything's working correctly. 换句话说,当我打开官方网站时,一切工作正常。 When i open redirect domain pointing on official website... the previous error appears. 当我打开指向官方网站上的重定向域时...出现先前的错误。 The line is exactly this -> imag.style.width=nextvar+'px' ; 该行就是这样-> imag.style.width=nextvar+'px' ;

Websites url -> domain1 (official) -> www[d0t]stasi*group[d0t]it // without * and -> domain2 (redirectdomain) -> www[d0t]villa*vittoria[d0t]it // without * 网站网址-> domain1(官方)-> www [d0t] stasi * group [d0t] it //不带*,-> domain2(重定向域)-> www [d0t] villa * vittoria [d0t] it //不带*

currently websites are work in progres 当前网站正在进步中

         ->

Are you using any AJAX? 您正在使用任何AJAX吗? I'd guess that you're experiencing the Single Origin Policy, which limits you to AJAX requests on the same domain - so if you have domain1.com and domain2.com, and are pulling in AJAX from domain1.com on both then it will fail on domain2.com. 我猜想您正在经历“单一来源策略”,该策略将您限制在同一域上的AJAX请求-因此,如果您具有domain1.com和domain2.com,并且都从domain1.com上提取AJAX,则它将将在domain2.com上失败。

Having the same site accessible on multiple domains is discouraged, as it's bad for SEO (although there are ways around this, such as canonical meta tags). 不建议在多个域上访问同一站点,因为这对SEO不利(尽管可以通过多种方法来解决,例如规范的元标记)。 Instead, redirect domain2.com to domain1.com 而是,将domain2.com重定向到domain1.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM