Some help with some basic code please


7twenty

Recommended Posts

So i've been looking at some extensions and trying to figure out some things, but javascript is for the most part a little over my head. Reading some books to see if it makes any more sense.

Can anyone give me a quick rundown on how to do something as simple as close the current tab?

I get that this first two lines need to be in the script to create a runtime for the rest to work in, but then it gets hazy?

var rt = window.external.mxGetRuntime();
var browser = rt.create("mx.browser.tabs");

mx.browser.tabs.getCurrentTab()
Tab.close()

Line 3 should be "browser.getCurrentTab()" to get the current tab as it uses the browser variable? what next?

Where does Tab.close() fit in? Do i need to create a function for this to work?

Link to comment
Share on other sites

i'll respond - only to say sorry i have no idea - javascript is a mystery to me - i think any that had knowledge have long since left - who in truth can blame them - it would be nice if one of the devs commented but thats asking far to much - its back to the one way street :wacko:

Tony     -  Vivaldi 4 on Windows 10 64Bit
Link to comment
Share on other sites

3 hours ago, 大笨狗 said:

Try this:


var myRuntime = window.external.mxGetRuntime();
var mxTabs = myRuntime.create('mx.browser.tabs');
var currentTab = mxTabs.getCurrentTab();
currentTab.close();

 

Hmmm, recognize the flower, thanx dev!

Edited by PHYR
Link to comment
Share on other sites

3 hours ago, PHYR said:

Hmmm, recognize the flower, thanx dev!

Likewise, I recognize the flower and the Chinese name, but didn't realize he's a dev (meaning Maxthon dev).  I do know his skin work,  very good and I'm still using one (Bing_Light) with some tweaks.

                            <<SL>>

Edited by SnowLeopard
Link to comment
Share on other sites