bookmarked javascript (bookmarklets)
Posted by: kmeleon_user
Date: July 17, 2010 06:08AM

I would like for javascript executed from a bookmark to be allowed to open a new window/tab regardless of the block pop-ups setting. A bookmark can only be executed by user action, so it should be regards like clicking a link.

Re: bookmarked javascript (bookmarklets)
Posted by: SoerenB
Date: July 18, 2010 12:13AM

Hi,

I don't understand what you're trying to do ... because all bookmarklets I know of HAVE to be opened in the current tab to work.

Maybe you want to read my post here, and elaborate on your question afterwards?

Cheers
SoerenB

No more own machines, because of addiction.
Don't know when I'll be back to normal ...

Re: bookmarked javascript (bookmarklets)
Posted by: kmeleon_user
Date: July 21, 2010 12:39PM

My bookmarklet does:

Get selected text on current page
if no selected text, prompt for input
if no input, do nothing
else open new tab/window based on input

if Tools->Privacy->Block Popups is checked, it will not open a new tab/window. If unchecked, it works fine. I would like it to not have to turn off the popup blocker to make it work. A user generated event (selecting a bookmark) should not qualify as an unwanted popup window. An anchor tag with an href='javascript:window.open();' works with the popup blocker on, a bookmarklet should as well.

Re: bookmarked javascript (bookmarklets)
Posted by: kmeleon_user
Date: July 21, 2010 12:51PM

I can have my bookmarklet create a button/link and append it to the page, then click on that to open the window and remove itself from the page, but that is getting complicated and bookmarklets are supposed to be simple. drool smiley
right now i just press F8 to turn off the popup blocker, use the bookmarklet, then F8 again; but that is still more actions than should be required (in my opinion).

Re: bookmarked javascript (bookmarklets)
Posted by: SoerenB
Date: July 21, 2010 05:30PM

Hi, kmeleon_user,

well, if you're trying to make that bookmarklet just for the satisfaction it gives you to be able to do it, don't read on.

Because all of that you want it to do (-and more) is easily done in the Context (-or RightClick) Menu. One missing feature can easly be added.

"open new tab/window based on input":
Well, ANY selected text's ContextMenu has even THREE related items
(in the lower part, but you could edit that to be moved up):

"Open as URL"
"Web Search"
"Translation"

The missing feature, being

"if no selected text, prompt for input"

can be added by pasting the line

"URLprompt=macros(OpenURL)" (without the quotes)

somewhere in the DocumentPopup{ or Document{
part of your menus.cfg (in the "settings" folder inside the "defaults" folder.)


Alternatively, if you tell me which skin you use, I could make you a toolbar/button for all 4 of the items ... The button would have one leftClick and 3 rightClick actions, but rightClick actions of buttons can also be triggered by longLeftClicking.
So if your reason for making a bookmarklet is a physical disability to use your RightButton, that would be the way to go.
(If it's just that you're not used to using your rightButton, I'd STRONGLY advise you: get used to it, and start by right- (or longLeft) Clicking your ToolbarButtons ... this is a really unique feature of K-Meleon!)

Cheers
SoerenB

No more own machines, because of addiction.
Don't know when I'll be back to normal ...

Re: bookmarked javascript (bookmarklets)
Posted by: kmeleon_user
Date: July 22, 2010 12:37AM

Thanks for the help. The main reason I have them as bookmarklets is that I can use them in other browsers as well. I use the bookmark toolbar so I get menus full of options that can do something with selected text/user input, or just be a bookmark if I don't supply input. They are easy to maintain, sort, and portable to other applications.

Using bookmarklets, I can select text in different frames and act on each set separately. I also have one that uses the xmlHTTPRequest (i think thats what it is) to get the current domain's robots.txt, parse it and turn everything listed into actual links and display that in a new tab/window. Correct me if I'm wrong, but I can't do that with a macro. Do macros/menu options allow me to parse the input with regular expressions? Bookmarklets do...

The issue, from my point of view, is that if a link to "javascript:window.open()" or a button/link/anything onclick="javascript:window.open()" will work with the popup blocker turned on, then a bookmark to "javascript:window.open()" should work as well. Even if I type "javascript:window.open()" in the URL bar, it doesn't work if the popup blocker is turned on.

I can resolve the issue to my satisfaction by either macros, more complicated javascript, or just turning off the popup blocker momentarily. I am just trying to get the developers to address this issue in any upcoming versions. User action instantiated javascript should not be subject to the popup blocker.

Re: bookmarked javascript (bookmarklets)
Posted by: kmeleon_user
Date: July 23, 2010 06:45AM

Quote
kmeleon_user
Using bookmarklets, I can select text in different frames and act on each set separately. I also have one that uses the xmlHTTPRequest (i think thats what it is) to get the current domain's robots.txt, parse it and turn everything listed into actual links and display that in a new tab/window. Correct me if I'm wrong, but I can't do that with a macro. Do macros/menu options allow me to parse the input with regular expressions? Bookmarklets do...

Well, I was wrong. I can use a macro to inject javascript and use regular expressions or anything else I want.

K-Meleon forum is powered by Phorum.