views:

47

answers:

1

I got a strange problem. I have a fullscreen image scaler javascript (as GOTOCHINA website) that works very well on my website.

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

Messagge: is not a valid argument.
Line: 34
Char: 17
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';

Websites url -> domain1 (official) -> www[d0t]stasi*group[d0t]it // without * and -> domain2 (redirectdomain) -> www[d0t]villa*vittoria[d0t]it // without *

currently websites are work in progres

         ->
+1  A: 

Are you using any 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.

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). Instead, redirect domain2.com to domain1.com

adam
Thank for your very quick reply !Well, you are right about SEO but i need these redirects because of other reasons :) I'm not using AJAX to redirect... the domain points to the official webiste by itself and the script doesn't work only when i open website from the domain2.com address... domain1.com address works perfectly
GiovanniDema
Are you using AJAX for anything? I wasn't particularly meaning for redirecting. Can you post a link to both domains? If so, update your question rather than posting as an answer.
adam
I'm using AJAX for other things in this website yes... the url will be updated right now on my question. Websites are work in progess.
GiovanniDema
Both sites look the same to me (in Safari 5), even when I click 'entra nel sito'
adam
Yes adam, the problem is with IE8(compatible) and IE7
GiovanniDema
Ah sorry, you did say that in the OP
adam
hope this would be useful... i can't figure out how that's possible
GiovanniDema