: K-Meleon Forum
K-Meleon development related discussions.
[quote=disrupted] i tested this thing for so long, it gave me a headache..there doesn't seem to be an automatic way using event handlers to inject a js or any command before/while the page load. in theory the opentab event should help but the problem with it (if you are using injectjs or injectcss) is that you need to place it in the new tab..right? but the opentab event will execute all your commands first before opening that..that includes fetching the url address.. in case you want to check a website's address before injecting your js. so what happens is, it gets the url address first(of the current tab/window) before it proceeds to open the tab so it doesn't work one very dumb way i tried was by using the id(new tab with the opentab event and then using the utils plugin first to delay it, hoping that way it would get the urladdress for the new tab instead of the previous current tab but this caused an instant crash the only way through the macro was by making a link menu command that opens the link in a new tab, and then injects the js..this does indeed inject the js during the page is loading but it's very unpractical because you will have to initiate it from a menu and second, you have no time to check the url..so the injected js will execute regardless if it's the right url or not, so you will need to write the url check in the js code itself and not in the macro..and ofcourse it wasn't foolproff even when the js was checking the page url because for example, if it did check the js but in the flick of time between checking the url and injecting, the user decided to switch tabs for any reason..it will inject in the wrong tab. it seems the best way for injecting some specific js .. especially automated ones that should not require user intervention is through greasemeleon..which is flawed and painful, personally i had too much trouble with it and it seems the best practise for greasemeleon is having no more than 3 or 4 scripts.. they have to be very well coded, less than 32kb(not a problem for most scripts) and they must not conflict in anyway with one another..one conflicting script will break greasemeleon. maybe in the future kko can make a nice event that initiates on pageload on preload? something like that..it will make it much easier.. for now, if you inject through macro, it will have to be on pageload and do not check page url, check for urlbar..or use greasemeleon with caution[/quote]
K-Meleon forum is powered by