> I am wanting to make a basic plugin for Safari. I don't know what kind
> of project I should choose. But I am planning on trying to use the
> Netscape api calls. But what kind of project do I use. A CFBundle,
> NSBundle -
Create a Carbon bundle for Netscape-style plugin or Cocoa bundle for
WebKit-style plugin.
> honestly I know nothing about either of them. Are these
> supposed to be like dll in Windows?
Yes, they are.
> Any help to get me started is
> appreciated.
WebKit documentation will help you. Also there is a good sample
NetscapeMoviePlugin (/Developer/Examples/WebKit/).
Hap - 29 Sep 2005 20:22 GMT
I looked at the NetscapeMoviePlugin and some other examples. I know
have just basic code that will write to a file the entry and exit
points. Could someone explain what I have wrong. I keep thinking the
.plist is wrong or something in my compile is wrong. I have the build
setup so tha it will produce a .plugin. I copy that into the
/Library/Internet Plug-Ins directory and run the Html in Safari 2.0.1.
It tells me:
The page "PluginTest.htm" has content of MIME type
"application/x-gc-plugin". Because you don't have a plug-in
installed for this MIME type, this content can't be displayed.
Here is my source for the project.
Thanks in advance
Cheers
-G
______________________
GC_CFPlugin.c
_______________________
#include "GC_CFPlugin.h";
//**************************************
// Function: NPP_Initialize
//**************************************
NPError NPP_Initialize ()
{
int rc;
rc = 0;
DebugLog("NPP_Initialize Entry");
DebugLog("NPP_Initialize Exit");
return (rc);
}
//**************************************
// Function: NPP_New
//**************************************
NPError NPP_New (NPMIMEType pluginType,
NPP instance,
uint16 mode,
int16 argc,
char* argn[],
char* argv[],
NPSavedData* saved)
{
int rc;
rc = 0;
DebugLog("NPP_New Entry");
DebugLog("NPP_New Exit");
return (rc);
}
//**************************************
// Function: NPP_Shutdown
//**************************************
void NPP_Shutdown ()
{
DebugLog("NPP_Shutdown Entry");
DebugLog("NPP_Shutdown Exit");
}
//**************************************
// Function: NPP_Destroy
//**************************************
NPError NPP_Destroy (NPP instance,
NPSavedData** save)
{
int rc;
rc = 0;
DebugLog("NPP_Destroy Entry");
DebugLog("NPP_Destroy Exit");
return (rc);
}
//**************************************
// Function: DebugLog
//**************************************
void DebugLog(char msg[])
{
FILE * pFile;
pFile = fopen ("myfile.txt","wt");
if (pFile!=NULL)
{
fputs (msg,
pFile);
fclose (pFile);
}
return;
}
_______________________
GC_CFPlugin.h
_______________________
#include <stdio.h>
#include <string.h>
#import <WebKit/WebKit.h>
void DebugLog (char[]);
_______________________
Info.plist
_______________________
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>GC_CFPlugin_Bundle</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.GC.GC_CFPlugin</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BRPLL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFPlugInDynamicRegisterFunction</key>
<string></string>
<key>CFPlugInDynamicRegistration</key>
<string>NO</string>
<key>CFPlugInFactories</key>
<dict>
<key>00000000-0000-0000-0000-000000000000</key>
<string>MyFactoryFunction</string>
</dict>
<key>CFPlugInTypes</key>
<dict>
<key>00000000-0000-0000-0000-000000000000</key>
<array>
<string>00000000-0000-0000-0000-000000000000</string>
</array>
</dict>
<key>CFPlugInUnloadFunction</key>
<string></string>
<key>WebPluginDescription</key>
<string>GC Plugins</string>
<key>WebPluginMIMETypes</key>
<dict>
<key>application/x-gc-plugin</key>
<dict>
<key>WebPluginExtensions</key>
<array>
<string>*</string>
</array>
<key>WebPluginTypeDescription</key>
<string>GC Plugin</string>
</dict>
</dict>
<key>WebPluginName</key>
<string>GC Plugin</string>
</dict>
</plist>
_______________________
test.html
_______________________
<html>
<body>
<EMBED type="application/x-gc-plugin" width="50" height="25"
disver="1">
</body>
</html>
_______________________