I have the following bookmarklet code that splits a web browser window into 2 frames to see different web pages side by side. The code works fine on some web sites but others it does not work, it will divide the window, start loading up the 1st frame then break out of frames and go to a full page. One particular site this occurs is on http://www.cbssports.com, the code asks for 2 URL's if I put in the CBS URL and then开发者_如何转开发 say Yahoo.com URL it will fill up with the CBS site. Any ideas why this is happening? Below is the code:
javascript:A14nH=location.href;L3f7=prompt('Choose File 1',A14nH);R1Gh7=prompt('Choose File 2',L3f7);if(L3f7&&R1Gh7){Fr4Q='\n';Fr4Q+='\n';Fr4Q+='';with(document){write(Fr4Q);void(close())}}else{void(null)}
Line 103 (at the time of writing this answer) of http://www.cbssports.com/ is this:
<script type="text/javascript">/* Window Management */ if(top != self){window.open(location.href, '_top');}</script>
That's pretty much saying if the top level window isn't CBS Sports (in other words, if it's framed), to open CBS Sports in the top level window, replacing whatever was framing it.
精彩评论