Question

I'm trying to debug a script written in javascript that runs on a conduit toolbar. for now i'm using simply

window.alert("function x is working");

but this is very disturbing in case of many alerts as the script grows bigger. i would prefer to write log or debug messages into FireBug or Chrome's console, with:

console.log("function x is working");

as this is much more reasonable, but this code has no effect when this is ran from a javascript file i include in an html component on a conduit toolbar.
i have really tried to research this and similar issues with conduit toolbar api, but i see they are not really common subjects here on stack.. does anyone know of a forum or a good resource of information for conduit api usage? their official page is a little confusing for me.

really appriciate any help!

Was it helpful?

Solution

Couldn't get much information on Conduit toolbar API here. This is a work-around that i thought of, hope this can help others.

var writeToConsoleScriptStr = 'console.log("your message here");';
JSInjection(writeToConsoleScriptStr);

This is helpful if you need to use other matters related to your page as well, for example using Jquery to run code when tab is focused/blurred. By the way, Both the writing to the console and JQuery for tab-switching events ran on all browsers that i checked, which was a nice touch.
Of course for running Jquery the actual page requires the page to include jquery which you can also achieve by injecting it the same way. (At a certain cost)

i'm hoping this may help somebody.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top