[thelist] view-source links /* was OT bottle opener */

Hassan Schroeder hassan at webtuitive.com
Thu Oct 25 14:35:40 CDT 2001


Richard Bennett wrote:
> 
> ----- Original Message -----
> From: "Hassan Schroeder" <hassan at webtuitive.com>
> > If you're using JavaScript to manipulate link properties, NS6.1
> > at least will throw an exception when it sees "view-source" as
> > a protocol; use (in, say, a for() loop) something like
> >
> >     try
> >     {
> >         if ( thisLink.protocol == "view-source:" )
> >         {
> >             continue;
> >         }
> >     }
> >     catch (oops)
> >     {
> >         ; // just ignore for now
> >     }
> 
> Actually I tested it, and found that
> view-source:http://www.evolt.org
> is working in Mozilla, NS6.01, NS4.7, IE6 and IE5.5.
> I didn't have time to check them all on a link in a website though, you
> might be right there.

Sorry, I probably wasn't clear about this: using a "view-source"
link is, in itself, just fine from what I've tried. 

The problem is if you're dynamically twiddling link properties in 
the page (changing style of off-site refs, or whatever) -- then the
"view-source" as protocol causes a JavaScript error.

> Wouldn't using try/catch cause an error in older browsers itself though?
> Isn't that only implemented in Javascript 1.5?

Oh, sure :-)  or at least -- 

This works in IE5.5 SP1, at least, with correct execution and no
JavaScript errors, as well as NS6.1 and Moz 0.9.3.

NS4.x will complain that 'try is a reserved identifier', so yes,
you want to avoid taking that code path with older browsers ...

-- 
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com 
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --




More information about the thelist mailing list