Skip navigation.

exploreopera

| Help

Sign up | Help

Posts tagged with "PAS"

NOSCRIPT for nerds. Stuff that disappears.

,

So, this is what a random Slashdot page looks like in Opera. That peaceful, white space in the centre sure isn't in the spirit of /. - or what? And why is there some odd overlapping box in the top left navigation area?



Sure enough, some text is missing, as re-loading with JavaScript disabled will show. The disappearing content occurs right after an ad script (URL will not unlikely die soon. Ads aren't exactly Cool URIs, but we already knew that..). Read this closely:

document.write('<script src=\"http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=rb&c=22&pli=319831&pi=0&w=336&h=280&ncu=$$http://ad.doubleclick.net/click%3Bh=v8/3682/3/0/%2a/b%3B155329471%3B0-0%3B3%3B13358361%3B255-0/0%3B24413359/24431212/1%3B%3B%7Esscs%3D%3f$$&ord=4781511\"><\/script>');document.write('\n<noscript>\n<a href=\"http://ad.doubleclick.net/click%3Bh=v8/3682/3/0/%2a/b%3B155329471%3B0-0%3B3%3B13358361%3B255-0/0%3B24413359/24431212/1%3B%3B%7Esscs%3D%3fhttp%3A//bs.serving-sys.com/BurstingPipe/BannerRedirect.asp%3FFlightID%3D319831%26Page%3D%26PluID%3D0%26Pos%3D4723\" target=\"_blank\"><img src=\"http://bs.serving-sys.com/BurstingPipe/BannerSource.asp?FlightID=319831&Page=&PluID=0&Pos=4723\" border=0 width=336 height=280></a>');


First time I saw an ad script do
document.write('<noscript><img src="..."></noscript>')
I laughed. Certainly a remarkably braindead way to include your fallback contents. But Slashdot's ads take it a step further: they use document.write to insert a NOSCRIPT tag but do not close it, hence hiding random amounts of content until the next NOSCRIPT close tag appears in the source! And it's not an Opera problem, it occurs randomly when you get the ads that come with the broken script, and happens in all browsers. In other words, Slashdot has finally proven that GUI browsers are unreliable and that everyone simply should telnet to port 80. Great news for nerds.

When it&#39;s broken, it&#39;s broken

,

Since I spend most of my day investigating problems with Opera, I'm sometimes too quick to take for granted that a problem is Opera's problem. So when I was exploring the JIRA site with an internal build of Opera, clicked a link saying JIRA video overview and saw nothing but an empty page and a very weird JS console error, I immediately started reducing the page to a small test case to file a bug report.

The error was completely incomprehensible, except that it seemed like Opera tried to execute some HTML markup as JavaScript:
Inline script compilation
Syntax error while loading: line 6 of inline script at http://www.atlassian.com/software/jira/videos/jira_video/jira_video.jsp :
Expected expression
<script language="JavaScript"></script><noscript></noscript><!--/DO NOT REMOVE/-->
--------------------------------------^


This sometimes happens if a file has a SCRIPT element with a SRC that links to a HTML file. But the page had only two external .js files, and neither was broken.

After a bit of trial and error I had a minimal file. The error occurs because a starting HTML comment inside a SCRIPT tag does not have a matching closing comment inside that SCRIPT tag. So Opera looks ahead for another closing comment, and it seems this confusion means some of the markup is seen as being "inside" the script.

Now I was in for a great surprise: both IE7 and Firefox 2 did exactly what Opera did when displaying my attempted test case! Have a look:
jira.htm
My first thought was that while minimising I had removed something that made the site work in IE and Firefox. Then I tried watching the video in either browser.. No joy. JIRA's video page is broken (by an Omniture SiteCatalyst script that carelessly omits a //--> from a script element) and - wow - they have broken it in a cross-browser compatible way!

Well, I just added that missing closing comment and re-loaded the page from cache in Opera - but I must be the only person who has seen JIRA's demo video recently :smile:

deviant mousedown

, , ,

Understanding other people's workarounds can be simply impossible. Take this example from the popular creative forum deviantART: if a member tries submitting a new entry from Opera, it will appear impossible to upload files because the "Choose" button does nothing when clicked. (Tabbing to it and pressing enter will work, but who'd think of that..)

The reason is buried deep inside this JS file:
if (window.browser && (browser.isGecko || browser.isOpera)) {
     uploadForm.onmousedown = function () { return false; }; // firefox only - screws up other browsers
}

So this "Firefox only" workaround against an unspecified problem I can't begin to understand is also applied to Opera - with the fatal result that we ignore any mouse clicks inside the upload form because the script cancels mousedown. I'm not sure who's deviating from what here..

(As an aside, code like this makes me pretty curious - what will show up in the site if I throw in a small user JS to set deviantART.pageData.i_am_super_privileged to true?
// most awesome hack ever
if (!path[1] && whoosh[0] == 'Fan Art' && deviantART.pageData && deviantART.pageData.i_am_super_privileged)
source)

Conditional identification

Spotted on foxnews.com:
<!--[if IE 5]> Vignette StoryServer 5.0 Thu Jul 26 11:23:40 2007 <![endif]-->

That's a peculiar use of conditional comments!

So the server says "hi, I'm Vignette StoryServer - but *only* if you are IE5".

Yep, and I'm Hallvord, but only if your name is Wim.
p:

can you improve ebDCKillCheckMousedown?

, ,

Busy with my regular passtime eBay JavaScript browsing (I think I spend more time on their site reading their .js files than looking at auction listings) I came across this:

var ebAllowClick=true;function ebDCKillCheckMousedown()
{if(ebAllowClick)
{ebAllowClick=false;setTimeout("ebAllowClick=true;",1250);}}
document.onclick=ebDCKillCheckMousedown;


Now, there is nothing technically wrong with that but I'm not terribly impressed with the quality of this snippet. Actually I find it hard to believe that a site with the scale and resources of eBay doesn't do review their scripts more carefully for efficiency.. but rather than me launching into one of my familiar rants I'll just pass the buck this time: so, if you were to teach the author a thing or two about efficient JavaScripting, what would you say?

Edit: proofreading the posted post I noticed yet another bug, not just performance improvements stuff..

Ryanair, meet Æ, Ø and Å

, ,

Ryanair, if you want customers to fly with you it may be a good idea to avoid rejecting them arbitrarily because they have names with characters outside US-ASCII. Seriously.