For Script Plug-ins, there are some extended DOM functions
These functions can only be accessed by the script plug-ins.
1.GetTabWin
2.GetTabCount
<script language=JavaScript>
var tabCount=external.GetTabCount([%Secure_Script_ID%]);
var urls='';
for( i = 0 ; i < tabCount; i++ )
{
urls=urls + window.external.GetTabWin([%Secure_Script_ID%], i).document.URL
+ '\n'
}
alert(urls);
</script>
Download the sample(GetTabCount)
Download the sample(GetTabWin)
Tip What is the [%Secure_Script_ID%]?
Without the ID, the script will not run. Just leave it there do
not change.
3.GetPopupBlocker
4.SetPopupBlocker
<script language=JavaScript>
var pop=window.external.GetPopupBlocker([%Secure_Script_ID%]);
//NOTE: the result is longint
if ((pop&1)==1)
{alert('AM Browser Smart pop-up blocker is on')}
else if ((pop&8)==8)
{alert('AM Browser Windows pop-up blocker is on')}
else
{alert('AM Browser pop-up blocker is off')}
</script>
<script language=JavaScript>
var pop=window.external.GetPopupBlocker([%Secure_Script_ID%]);
//Save the popup blocker settings
//NOTE: the result is longint
window.external.SetPopupBlocker([%Secure_Script_ID%], 0);
//disable the popup blocker to open a new window
window.open('http://www.AMBrowser.com');
window.external.SetPopupBlocker([%Secure_Script_ID%], pop);
//Ok, set the settings back
</script>
Download the sample(GetPopupBlocker)
Download the sample(SetPopupBlocker)
5. GetActiveTabIdx
<script language=JavaScript>
alert(window.external.GetActiveTabIdx([%Secure_Script_ID%]));
</script>
Download the sample(GetActiveTabIdx)
6.SetActiveTab
<script language=JavaScript>
var idx=window.external.GetTabCount([%Secure_Script_ID%]);
idx = idx - 1;
//Make the last tab active
window.external.SetActiveTab([%Secure_Script_ID%], idx);
</script>
Download the sample(SetActiveTab)
7.WriteINI
8. ReadINI
<script language=JavaScript>
window.external.WriteINI([%Secure_Script_ID%], 'test.ini', 'TestSection',
'TestIdent', 'This is a Test');
//Note: The WriteINI does not create new file, you shoud create
the file yourself
var get=window.external.ReadINI([%Secure_Script_ID%], 'test.ini',
'TestSection', 'TestIdent', '');
alert(get);
</script>
Download the sample(ReadWriteINI)
Note:
The WriteINI does not create new file, you shoud create the file
yourself.
You can only access the ini file in your plug-in directory.
WriteINI([%Secure_Script_ID%], 'FileName', 'Section', 'Ident',
'Value');
ReadINI([%Secure_Script_ID%], 'FileName', 'Section', 'Ident', 'Default');