JQUERY Shadowbox.js燈箱效果 Bug For IE瀏覽器

最近就在小編的後台管理系統要完成時,發生了悲劇。
小編我習慣使用Chrome來上網,也會使用火狐來測試,之後才會用IE測試
因為IE版本最多,目前WindowsXP最高可以到8.0的版本
所以我就維持在8.0。
就在我使用IE8.0的時候,居然登入後無法使用。
真的是害我整個傻眼。













出現的錯誤為「沒有使用權限」
Oh!~天啊! 一開始以為是版本太舊,就去下載新版本
結果還是一樣

後來Google了一下,很多人說是 JQuery在跨域傳值的部分會有問題
可能是安全性的關係。

於是就開始階段性的查這個Bug,皇天不負苦心人,
終於找到是在引入  Shadowbox.js 的部分發現錯誤,

shadowbox.js大約在第8行
(function(window,undefined){var S={version:"3.0.3"};var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")>-1||ua.indexOf("win32")>-1){S.isWindows=true}else{if(ua.indexOf("macintosh")>-1||ua.indexOf("mac os x")>-1){S.isMac=true}else{if(ua.indexOf("linux")>-1){S.isLinux=true}}}S.isIE=ua.indexOf("msie")>-1;S.isIE6=ua.indexOf("msie 6")>-1;S.isIE7=ua.indexOf("msie 7")>-1;S.isGecko=ua.indexOf("gecko")>-1&&ua.indexOf("safari")==-1;S.isWebKit=ua.indexOf("applewebkit/")>-1;var inlineId=/#(.+)$/,galleryName=/^(light|shadow)box\[(.*?)\]/i,inlineParam=/\s*([a-z_]*?)\s*=\s*(.+)\s*/,fileExtension=/[0-9a-z]+$/i,scriptPath=/(.+\/)shadowbox\.js/i;var open=false,initialized=false,lastOptions={},slideDelay=0,slideStart,slideTimer;S.current=-1;S.dimensions=null;S.ease=function(state){return 1+Math.pow(state-1,3)};S.errorInfo={fla:{name:"Flash",url:"http://www.adobe.com/products/flashplayer/"},qt:{name:"QuickTime",url:"http://www.apple.com/quicktime/download/"},wmp:{name:"Windows Media Player",url:"http://www.microsoft.com/windows/windowsmedia/"},f4m:{name:"Flip4Mac",url:"http://www.flip4mac.com/wmv_download.htm"}};S.gallery=[];S.onReady=noop;S.path=null;S.player=null;S.playerId="sb-player";S.options={animate:true,animateFade:true,autoplayMovies:true,continuous:false,enableKeys:true,flashParams:{bgcolor:"#000000",allowfullscreen:true},flashVars:{},flashVersion:"9.0.115",handleOversize:"resize",handleUnsupported:"link",onChange:noop,onClose:noop,onFinish:noop,onOpen:noop,showMovieControls:true,skipSetup:false,slideshowDelay:0,viewportPadding:20};S.getCurrent=function(){return S.current>-1?S.gallery[S.current]:null};S.hasNext=function(){return S.gallery.length>1&&(S.current!=S.gallery.length-1||S.options.continuous)};S.isOpen=function(){return open};S.isPaused=function(){return slideTimer=="pause"};S.applyOptions=function(options){lastOptions=apply({},S.options);apply(S.options,options)};S.revertOptions=function(){apply(S.options,lastOptions)};S.init=function(options,callback){if(initialized){return}initialized=true;if(S.skin.options){apply(S.options,S.skin.options)}if(options){apply(S.options,options)}if(!S.path){var path,scripts=document.getElementsByTagName("script");for(var i=0,len=scripts.length;imaxHeight){height=maxHeight-extraHeight}var extraWidth=2*padding+leftRight;if(width+extraWidth>maxWidth){width=maxWidth-extraWidth}var changeHeight=(originalHeight-height)/originalHeight,changeWidth=(originalWidth-width)/originalWidth,oversized=(changeHeight>0||changeWidth>0);if(preserveAspect&&oversized){if(changeHeight>changeWidth){width=Math.round((originalWidth/originalHeight)*height)}else{if(changeWidth>changeHeight){height=Math.round((originalHeight/originalWidth)*width)}}}S.dimensions={height:height+topBottom,width:width+leftRight,innerHeight:height,innerWidth:width,top:Math.floor((maxHeight-(height+extraHeight))/2+padding),left:Math.floor((maxWidth-(width+extraWidth))/2+padding),oversized:oversized};return S.dimensions};S.makeGallery=function(obj){var gallery=[],current=-1;if(typeof obj=="string"){obj=[obj]}if(typeof obj.length=="number"){each(obj,function(i,o){if(o.content){gallery[i]=o}else{gallery[i]={content:o}}});current=0}else{if(obj.tagName){var cacheObj=S.getCache(obj);obj=cacheObj?cacheObj:S.makeObject(obj)}if(obj.gallery){gallery=[];var o;for(var key in S.cache){o=S.cache[key];if(o.gallery&&o.gallery==obj.gallery){if(current==-1&&o.content==obj.content){current=gallery.length}gallery.push(o)}}if(current==-1){gallery.unshift(obj);current=0}}else{gallery=[obj];current=0}}each(gallery,function(i,o){gallery[i]=apply({},o)});return[gallery,current]};S.makeObject=function(link,options){var obj={content:link.href,title:link.getAttribute("title")||"",link:link};if(options){options=apply({},options);each(["player","title","height","width","gallery"],function(i,o){if(typeof options[o]!="undefined"){obj[o]=options[o];delete options[o]}});obj.options=options}else{obj.options={}}if(!obj.player){obj.player=S.getPlayer(obj.content)}var rel=link.getAttribute("rel");if(rel){var match=rel.match(galleryName);if(match){obj.gallery=escape(match[2])}each(rel.split(";"),function(i,p){match=p.match(inlineParam);if(match){obj[match[1]]=match[2]}})}return obj};S.getPlayer=function(content){if(content.indexOf("#")>-1&&content.indexOf(document.location.href)==0){return"inline"}var q=content.indexOf("?");if(q>-1){content=content.substring(0,q)}var ext,m=content.match(fileExtension);if(m){ext=m[0].toLowerCase()}if(ext){if(S.img&&S.img.ext.indexOf(ext)>-1){return"img"}if(S.swf&&S.swf.ext.indexOf(ext)>-1){return"swf"}if(S.flv&&S.flv.ext.indexOf(ext)>-1){return"flv"}if(S.qt&&S.qt.ext.indexOf(ext)>-1){if(S.wmp&&S.wmp.ext.indexOf(ext)>-1){return"qtwmp"}else{return"qt"}}if(S.wmp&&S.wmp.ext.indexOf(ext)>-1){return"wmp"}}return"iframe"};function filterGallery(){var err=S.errorInfo,plugins=S.plugins,obj,remove,needed,m,format,replace,inlineEl,flashVersion;for(var i=0;i"}else{remove=true}}else{if(obj.player=="inline"){m=inlineId.exec(obj.content);if(m){inlineEl=get(m[1]);if(inlineEl){obj.content=inlineEl.innerHTML}else{remove=true}}else{remove=true}}else{if(obj.player=="swf"||obj.player=="flv"){flashVersion=(obj.options&&obj.options.flashVersion)||S.options.flashVersion;if(S.flash&&!S.flash.hasFlashPlayerVersion(flashVersion)){obj.width=310;obj.height=177}}}}if(remove){S.gallery.splice(i,1);if(i0?i-1:i}}--i}}}function listenKeys(on){if(!S.options.enableKeys){return}(on?addEvent:removeEvent)(document,"keydown",handleKey)}function handleKey(e){if(e.metaKey||e.shiftKey||e.altKey||e.ctrlKey){return}var code=keyCode(e),handler;switch(code){case 81:case 88:case 27:handler=S.close;break;case 37:handler=S.previous;break;case 39:handler=S.next;break;case 32:handler=typeof slideTimer=="number"?S.pause:S.play;break}if(handler){preventDefault(e);handler()}}function load(changing){listenKeys(false);var obj=S.getCurrent();var player=(obj.player=="inline"?"html":obj.player);if(typeof S[player]!="function"){throw"unknown player "+player}if(changing){S.player.remove();S.revertOptions();S.applyOptions(obj.options||{})}S.player=new S[player](obj,S.playerId);if(S.gallery.length>1){var next=S.gallery[S.current+1]||S.gallery[0];if(next.player=="img"){var a=new Image();a.src=next.content}var prev=S.gallery[S.current-1]||S.gallery[S.gallery.length-1];if(prev.player=="img"){var b=new Image();b.src=prev.content}}S.skin.onLoad(changing,waitReady)}function waitReady(){if(!open){return}if(typeof S.player.ready!="undefined"){var timer=setInterval(function(){if(open){if(S.player.ready){clearInterval(timer);timer=null;S.skin.onReady(show)}}else{clearInterval(timer);timer=null}},10)}else{S.skin.onReady(show)}}function show(){if(!open){return}S.player.append(S.skin.body,S.dimensions);S.skin.onShow(finish)}function finish(){if(!open){return}if(S.player.onLoad){S.player.onLoad()}S.options.onFinish(S.getCurrent());if(!S.isPaused()){S.play()}listenKeys(true)}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(obj,from){var len=this.length>>>0;from=from||0;if(from<0 data-blogger-escaped--1="" data-blogger-escaped-addevent.guid="1;addEvent.handleEvent=function(event){var" data-blogger-escaped-addevent.handleevent="" data-blogger-escaped-addevent.preventdefault="function(){this.returnValue=false};addEvent.stopPropagation=function(){this.cancelBubble=true};addEvent.fixEvent=function(e){e.preventDefault=addEvent.preventDefault;e.stopPropagation=addEvent.stopPropagation;return" data-blogger-escaped-addevent="" data-blogger-escaped-alpha="" data-blogger-escaped-appendhtml="function(el,html){if(el.insertAdjacentHTML){el.insertAdjacentHTML(" data-blogger-escaped-apply="" data-blogger-escaped-bindload="" data-blogger-escaped-body.appendchild="" data-blogger-escaped-body.firstchild="" data-blogger-escaped-body="document.body,div=document.createElement(" data-blogger-escaped-callback="" data-blogger-escaped-catch="" data-blogger-escaped-checksupport="" data-blogger-escaped-clearopacity="function(el){S.setOpacity(el,1)};function" data-blogger-escaped-client="" data-blogger-escaped-complete="" data-blogger-escaped-computedstyle="getComputedStyle(el,null);if(computedStyle){ret=computedStyle[style]}if(style==" data-blogger-escaped-date="" data-blogger-escaped-delete="" data-blogger-escaped-dimension="" data-blogger-escaped-div.style.margin="0;div.style.top=" data-blogger-escaped-div.style.opacity="==" data-blogger-escaped-div.style.position="fixed" data-blogger-escaped-div="" data-blogger-escaped-document.addeventlistener="" data-blogger-escaped-document.attachevent="" data-blogger-escaped-document.body="" data-blogger-escaped-document.detachevent="" data-blogger-escaped-document.documentelement.doscroll="" data-blogger-escaped-document.documentelement="" data-blogger-escaped-document.getelementbyid="" data-blogger-escaped-document.readystate="==" data-blogger-escaped-doscrollcheck="" data-blogger-escaped-e.preventdefault="" data-blogger-escaped-e.which:e.keycode="" data-blogger-escaped-e.which="" data-blogger-escaped-e="" data-blogger-escaped-each="" data-blogger-escaped-eforeend="" data-blogger-escaped-egexp.="" data-blogger-escaped-el.addeventlistener="" data-blogger-escaped-el.currentstyle="" data-blogger-escaped-el.events="" data-blogger-escaped-el.lastchild="" data-blogger-escaped-el.nodetype="==3||el.nodeType===8){return}if(el.setInterval&&(el!==window&&!el.frameElement)){el=window}if(!handler.__guid){handler.__guid=addEvent.guid++}if(!el.events){el.events={}}var" data-blogger-escaped-el.parentnode.removechild="" data-blogger-escaped-el.removeeventlistener="" data-blogger-escaped-el="" data-blogger-escaped-else="" data-blogger-escaped-extension="" data-blogger-escaped-f4m="names.indexOf(" data-blogger-escaped-false="" data-blogger-escaped-for="" data-blogger-escaped-frag="range.createContextualFragment(html);el.appendChild(frag)}else{el.innerHTML=html}}};S.getWindowSize=function(dimension){if(document.compatMode===" data-blogger-escaped-from="" data-blogger-escaped-function="" data-blogger-escaped-g="" data-blogger-escaped-get="" data-blogger-escaped-getcomputedstyle="" data-blogger-escaped-getpagexy="" data-blogger-escaped-gettarget="" data-blogger-escaped-gettime="" data-blogger-escaped-gi="" data-blogger-escaped-handler.__guid="" data-blogger-escaped-handler="" data-blogger-escaped-handlers="" data-blogger-escaped-html="" data-blogger-escaped-i="" data-blogger-escaped-if="" data-blogger-escaped-in="" data-blogger-escaped-keycode="" data-blogger-escaped-left="" data-blogger-escaped-len="" data-blogger-escaped-lip4mac="" data-blogger-escaped-load="" data-blogger-escaped-loaded="true;checkSupport();S.onReady();if(!S.options.skipSetup){S.setup()}S.skin.init()};S.plugins={};if(navigator.plugins&&navigator.plugins.length){var" data-blogger-escaped-match="" data-blogger-escaped-names="[];each(navigator.plugins,function(i,p){names.push(p.name)});names=names.join(" data-blogger-escaped-new="" data-blogger-escaped-noop="" data-blogger-escaped-now="" data-blogger-escaped-obj="" data-blogger-escaped-ompat="" data-blogger-escaped-on="" data-blogger-escaped-onload="" data-blogger-escaped-onreadystatechange="" data-blogger-escaped-ontentloaded="" data-blogger-escaped-opacity="+(opacity*100)+" data-blogger-escaped-original="" data-blogger-escaped-parsefloat="" data-blogger-escaped-preventdefault="" data-blogger-escaped-property="" data-blogger-escaped-px="" data-blogger-escaped-range="el.ownerDocument.createRange();range.setStartAfter(el.lastChild);var" data-blogger-escaped-remove="" data-blogger-escaped-removeevent="" data-blogger-escaped-replace="" data-blogger-escaped-result="" data-blogger-escaped-ret="" data-blogger-escaped-return="" data-blogger-escaped-s.load="" data-blogger-escaped-s="" data-blogger-escaped-setopacity="function(el,opacity){var" data-blogger-escaped-settimeout="" data-blogger-escaped-sprintf="" data-blogger-escaped-str.replace="" data-blogger-escaped-str="" data-blogger-escaped-string="" data-blogger-escaped-style.filter="(style.filter||" data-blogger-escaped-style.zoom="1;if(opacity==1){if(typeof" data-blogger-escaped-supportsfixed="div.offsetTop==20;body.removeChild(div)}S.getStyle=(function(){var" data-blogger-escaped-supportsopacity="" data-blogger-escaped-target.nodetype="=3?target.parentNode:target}function" data-blogger-escaped-target="e.target?e.target:e.srcElement;return" data-blogger-escaped-test="" data-blogger-escaped-this.__handleevent="handlers[i];if(this.__handleEvent(event)===false){result=false}}return" data-blogger-escaped-this="" data-blogger-escaped-toplevel="false;try{topLevel=window.frameElement===null}catch(e){}if(document.documentElement.doScroll&&topLevel){doScrollCheck()}}}}S.load=function(){if(loaded){return}if(!document.body){return" data-blogger-escaped-try="" data-blogger-escaped-type="" data-blogger-escaped-value="obj[0];i<len&&callback.call(value,i,value)!==false;value=obj[++i]){}}function" data-blogger-escaped-var="" data-blogger-escaped-w="" data-blogger-escaped-window.addeventlistener="" data-blogger-escaped-window.attachevent="" data-blogger-escaped-x="e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));return[x,y]}function" id="">-1;S.plugins={fla:names.indexOf("Shockwave Flash")>-1,qt:names.indexOf("QuickTime")>-1,wmp:!f4m&&names.indexOf("Windows Media")>-1,f4m:f4m}}else{var detectPlugin=function(name){var axo;try{axo=new ActiveXObject(name)}catch(e){}return !!axo};S.plugins={fla:detectPlugin("ShockwaveFlash.ShockwaveFlash"),qt:detectPlugin("QuickTime.QuickTime"),wmp:detectPlugin("wmplayer.ocx"),f4m:false}}var relAttr=/^(light|shadow)box/i,expando="shadowboxCacheKey",cacheKey=1;S.cache={};S.select=function(selector){var links=[];if(!selector){var rel;each(document.getElementsByTagName("a"),function(i,el){rel=el.getAttribute("rel");if(rel&&relAttr.test(rel)){links.push(el)}})}else{var length=selector.length;if(length){if(typeof selector=="string"){if(S.find){links=S.find(selector)}}else{if(length==2&&typeof selector[0]=="string"&&selector[1].nodeType){if(S.find){links=S.find(selector[0],selector[1])}}else{for(var i=0;i
看起來是使用 Flash影片播放器時 需檢查 Flash版本之後
若版本過就,就會跳至Adobe網站 傳送下載更新請求。
於是就變成了不同網域的傳值。
將此段取消就可以了

沒有留言:

張貼留言