Besttoolbars Development network

Back to Besttoolbars main site

 

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Javascript in Firefox

 
Post new topic   Reply to topic    BestToolbars.Net Forum Index -> Mozilla/Firefox conversion
Author Message
chwanyin



Joined: 13 Mar 2008
Posts: 1

PostPosted: Thu Mar 13, 2008 10:36 pm    Post subject: Javascript in Firefox Reply with quote

Dear Dir

i ran the following sample code in firefox. it doesn't work. How should i do to make it work in firefox? Thanks

function Launch(tool)
{
var newDiv = MainWindow.document.createElement("<DIV id=\"peekiaddition\"
style=\"position: absolute; right: 0px; top: 0px; width: 90px; padding-left: 4px; paddingbottom:
1px; z-index: 102; opacity: 0.7; filter: alpha(opacity=70); font-family: arial; fontsize:
10pt; font-weight: normal; color: #000000; background-color: #FFDD69;\">");
newDiv.innerText="Web access";
MainWindow.document.body.insertBefore(newDiv);
}
Back to top
Admin
Site Admin


Joined: 22 Aug 2006
Posts: 1055

PostPosted: Fri Mar 14, 2008 6:25 am    Post subject: Reply with quote

There is no Mainwindow object for Firefox browser.

Please, find the differences between IE and FF in the Embedded help of ToolbarStudio/Firefox section
Back to top
blp330



Joined: 06 Mar 2008
Posts: 13

PostPosted: Wed Mar 19, 2008 3:41 am    Post subject: Reply with quote

There is no Mainwindow object for Firefox browser.

This is not mentioned even in ToolbarStudio/Firefox section.

The documentation almost is helpless.

So how programmer to know that? Try and error... a waste time job.

In my experience, you must try this:
Code:

function Launch(tool)  {
var isIE;
var document = null;

try {
    if(MainWindow != undefined) {
        isIE = true;
        document = MainWindow.document;
    }
} catch(e) {
    isIE = false;
    document = tool.explorer.document;
}

var div = document.createElement(.........)
}


This is a terrible design to make programmer feel bad.

Some simple way ToolbarStudio should do is to make a global object MainWindow = tool.explorer in firefox, or export document object as global object and a global variable "isIE" to reduce our work.

This is a simple effort but it will make programmer feel better and easy to use this product.

If a product waste programmer's time more, more programmer will give it up.

I like this product, but in many aspect, it should be improved, especially in API design between IE and Firefox.

Thanks.
Back to top
Admin
Site Admin


Joined: 22 Aug 2006
Posts: 1055

PostPosted: Wed Mar 19, 2008 7:44 am    Post subject: Reply with quote

Please, also try tool.window instead.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BestToolbars.Net Forum Index -> Mozilla/Firefox conversion All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group

Copyright c Softomate, 2010. All Rights Reserved
Terms of Service | Privacy Policy