Robert Apostolico
Guest
|
Hello.
If I inject custom css or javascript that requires paths to images/etc,
do I have the ability to alter the css/js at injection-time to specify a relative path like "images/buttonsave.png" (assuming images is a subdirectory of where the add-in was installed),
-or- is there a predefined Macro that will automatically expand to full-path add-on install folder:
@IEextension() + "/images/buttonsave.png" - expands to ->
file:///c:/users/bob/appdata/roaming/add-in-express/my-add-in/images/buttonsave.png ??
-or- do I need to specify these types of file-paths via the web:
http://www.xyz.com/add-on/images/buttonsave.png
??
What is the best practice here?
Thank you. |
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello Robert,
Please search the the PDF file in the folder {Add-in Express}\Docs on your development PC for the following text:
Modifying the document by adding a script and a button that calls the script
I wonder if this is what you are looking for. If you write in C#, please use any free VB.NET to CSharp code converter available on the web.
Andrei Smolin
Add-in Express Team Leader |
|
Robert Apostolico
Guest
|
Andrei,
I reviewed that sample and it is not exactly what I'm looking for.
For example ( this is Google/Chrome code ):
var psHtmlTemplate = chrome.extension.getURL("gmail/gmToolBar.html");
var psImgSrc = chrome.extension.getURL("images/logo.png");
In the "chrome" world, there is an extension class and a getURL function that returns the runtime path of where the extension is running from, so resources ( images, html ) that were distributed with the plugin can be accessed from the injected JavaScript that's runnning.
Is there anything like that in the IE extension world?
Thank you. |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Robert,
There is not such a feature in IE object model. But you can try to search for HTML resources in the cache using the 'ADXIEHelper.FindCacheEntries' method or add a new file to cache using 'ADXIEHelper.CreateCacheEntry'.
e.g.
ArrayList entries = ADXIEHelper.FindCacheEntries("https://www.google.com/*");
foreach (ADXIEHelper.ADXIECacheEntry entry in entries)
{
if ((!String.IsNullOrEmpty(entry.FileName)) && entry.FileName.EndsWith("png"))
{
// here you will get something like:
// C:\Users\<user name>\AppData\Local\Microsoft\Windows\INetCache\Low\IE\0F8167G7\mgyhp_sm[1].png
}
} |
|