javascript:; issues

56 views
Skip to first unread message

Marc J. Cawood

unread,
Oct 29, 2016, 3:29:25 AM10/29/16
to TiddlyWiki
I run TW as a .hta (i.e. IE7 mode). IMHO the best way to run TW in a Windows environment.

However, I occasionally a window popping up with the URL "javascript:;".

It has to do with the href attribute of tiddly buttons (`function createTiddlyButton()`):

btn.setAttribute("href","javascript:;");

It seems that when the onclick action (often overridden by plugins) does not return `false` the browser defaults to opening the link.

I've experimented with `javascript:void()` (no help) but `#` helps. The `#` option works the best because it stops a new window but it does jump to the top of the page which is not ideal.

By far the best option however is simply commenting out the line which sets the href attribute.

Does TW really need to set the href attribute? It works fine as far as I can see without the href attribute.



Marc J. Cawood

unread,
Oct 29, 2016, 11:42:12 AM10/29/16
to TiddlyWiki

Does TW really need to set the href attribute? It works fine as far as I can see without the href attribute.

The only difference I notice is the cursor. So I suggest the following change - instead of setAttribute('href', ...) use

btn.style.cursor = "pointer";

 
Reply all
Reply to author
Forward
0 new messages