Recent Topics

1 Dec 07, 2005 06:41    

The validate_url function fails to allow "href=javascript:void(0)", despite adding it as an allowed scheme.

I tried a few permutations:
javascript: void(0)
javascript: void(0);
etc ...

same result.

2 Dec 08, 2005 13:34

Well your syntax above was wrong.
Should be:

<a href="javascript: void(0);">Link</a>

Not sure wether it has anything to do with your problem though, because i didn't understand what was wrong.[/quote]

3 Dec 08, 2005 18:32

balupton,

The syntax is not "wrong". Unlike PHP, in javascript, the use of the semi-colon to terminate a statement is optional. Have a quick look [url=http://phplens.com/phpeverywhere/node/view/30]here[/url] which confirms this.

Either way ... if you re-read the original post, you'll notice that I DID try the syntax that you think is "correct". It still is disallowed as a "Invalid URL".

blueyed,

So ... looking at the high falutin' new REGEX in the validate_url function, i'm guessing that the authority URL requirement is killing the javascript:void(0) link. And, I'm guessing (to keep other javascript out of the URL, perhaps?).

OKAY ... but couldn't we allow "javascript:void(0)" as an EXCEPTION?

People might argue that a dead link is a "not needed" link, but in this particular usage, it's so that a [url=http://randsco.com/index.php/2005/06/15/introducing_photo_caption_zoom_2]css-zoomed image[/url] zooms on hover and has the behavior of an image, rather than a link. (Killing the link is needed b/c of IE's lack of support for the :hover pseudo-class for anything other than an <a> tag).

If b2evo won't accept "javascript:void(0)" as a valid URL, then there will be a number of blogs with the photo-zoom feature already installed that will suddenly "BREAK" (as javascript:void(0) has previously been allowed, by adding javascript as a scheme).

Can it (pretty please, with sugar on top) be allowed as an exception in the final code?

TIA for your consideration,

-stk :D

4 Dec 08, 2005 18:41

The whole point of validate_url is to prevent nasty things such as Javascript. There will be no exception.

If you want to shoot a hole into your foot, you can still hack the code.

Though, I'd rather recommend changing your href="javascript:void(0)" to href="#".

5 Dec 08, 2005 18:46

actually ur syntax was wrong, i was not pointing out the use of the semicolon but the use of "s
Mozilla browsers follow standards, and one of the standards is to have everything in "s, so no href=cool.htm, it must be href="cool.htm".
Also w3c will yell at you if you dont use quotes.
Plus with your first example it also could of suggested that you were doing <a "href=javascript:void(0)" >Link</a>

Anyway i have no idea wot void(0) does or when you will need to use it.
So i can't help you there, i just noticed ur syntax, made my post, and that was that.

6 Dec 08, 2005 20:31

balupton,

Yer reading a bit too much between the lines. The statement wasn't inside a code tag for a reason ... it's not syntax ... merely a quoted reference to the fact that I'm trying to add href=javascript:void(0) and the bloody validate_url function isn't accepting it.

Have a nice day.

-stk :D

7 Dec 08, 2005 20:40

fplangue,

Thank you for responding.

(1) I was thinking more specific, like

if (url="javascript:void(0);") { return } 

(2) Your suggestion href="#" won't work (too short) :p

If I do hack the code, it will be to bypass the URL check completely for authorized users. ;) (Seems to me that the author should decide what URL flies and what doesn't).

Also ... whole topic might be moot, as I think something like

<a href="http://mysite.com/someBlankPage.htm" onclick="return false">blah</a>

could probably achieve the same thing.

Twas just a shock to discover all my old posts with pictures now yield an "Invalid URL" ... despite the XHTML-valid code.

-stk :D

8 Dec 08, 2005 20:58

if (url="javascript:void(0);") { return }

So, seeing as how that statement WAS in a code tag, shouldn't it read :-

Code:
if ($url=="javascript:void(0);") { return; }

:roll:

¥

9 Dec 08, 2005 21:03

Hahaha, pwnd.
Sorry i had to say that.

But what is the reason for doing a dead link anyway? :S

Have a nice day
-balupton

11 Dec 09, 2005 00:14

omg, yer a french-canadian displaced yank :O

¥


Form is loading...