Safari App Extensions: Can the injected script load resources from the app bundle? - safari-app-extension

I have a Safari App Extension that injects a script into the host page. From that injected script, is it possible to load resources such as images or stylesheets from the main app bundle? (I mean directly, without sending messages between the two.)

I suppose yes. In your injected script, the path to an asset called "gigou.css" located in your extension's bundle should be accessible with safari.extension.baseURI + 'gigou.css'. Then you should be able to write dynamically a link or script tag and inject it into the document.

Related

Can I create an Electron app with only index.html (and NO other files)?

In Electron v20.0.2, it possible to enable nodeIntegration (disable contextIsolation) and use a <script> tag to embed all business logic within a single index.html (no separate main.js, renderer.js, or package.json)?
I'm looking to embed a preexisting, fully-trusted intranet-only website into a frame with limited user inspectability, but I will need to wrap this interaction with filesystem and process-table access.
This is not possible. You must have an entrypoint main.js file that initializes the Electron renderer, and a separate index.html file to bootstrap the DOM.

Chrome Extension with CRA - web accessible resources

I am building a chrome extension with create-react-app.
This gives me a folder structure as follows:
my_app/
public/
options.html
popup.html
manifest.json
src/
background.js
index.js
options.js
I want to add a new html page to the extension which can then be called via chrome-extension://[runtime_id]/my_new_page.html
To do so, I placed my_new_page.html in the /public folder and added it to manifest.json under web_accessible_resources.
However when I load chrome-extension://[runtime_id]/my_new_page.html I get only the boilerplate of my_new_page.html and the js which is supposed to render the app content, is not run.
Turns out the problem was with the way my webpack.config handled my bundles. Whatever goes into the build folder is handled by webpack and thus configurations might be required - and can vary depending on what boilerplate/template you are using.

quasar SPA build produces blank page with Node.js both locally and globally

I just built my app with quasar CLI.
This is my quasar info:
I made a regular spa build knowing that it’s not be sitting directly in root folder on the server, so I changed publicPath:
Server-side static frontpage files are served OK for the main page and the main page has a link pointing to http://localhost:3000/application which produces blank page with this error:
Elements tab looks skim, #q-app does not have any content:
Network connections with 30x status:
What am I missing? Could it be related to build itself or is it something in my node-server?
Github said something about lazy-loaded components and dynamic-import-node plugin, so I added it before build:
I've gone through script tags in the DOM just to see that their source attributes where all absolute, so I changed them to relative paths by modifying quasar.conf like this:
publicPath: '/application'
That's all it took to make it work :)

Image is not loaded in MVC5 JQuery during initial Load requested via IIS

1.When pointing the URL as "http:/servername/virtualdirectory" and for example i am setting image path as ../Content/Images/xx.png using jquery in js file then the images is not loaded
2.When pointing the URL as "http:/servername/virtualdirectory/controllername/action" and for example i am setting image path as ../Content/Images/xx.png using jQuery in js file then the Images is loaded.
Questions is why the image is not loaded during IIS request from routeconfig.cs ie 'http:/servername/virtualdirectory' in MVC5
Try using <img src="~/Content/Images/xx.png"> in your Razor syntax. This will generate a correct path to your image.

accessing extension stylesheets via extension javascript

I have a chrome content script extension that includes a css file (mystyle.css) which is bundled into the extenstion CRX. As far as I can tell, there are two ways to inject this this stylesheet into the content of a page.
No matter which way the stylesheet is injected into the page, I cannot access the CSS rules associated with that stylesheet.
Injection method #1:
// From a script running in the context of background.html:
chrome.tabs.insertCSS(tab.id, {file: 'mystyle.css'});
Injection method #2:
// From a script running in the context of the content, already
// injected by the background page via chrome.tabs.executeScript.
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href",
chrome.extension.getURL('mystyle.css'));
From JavaScript running in the context of the content, injected by the background page, I cannot see the stylesheet in the list of those listed in document.styleSheets, when it is injected using method #1. When injected using method #2, it is listed with a chrome-extension:// href, but the cssRules property of that the sheet is always null.
I would expect this for CSS sheets that are linked to the document from other domains, but my script should have access to chrome-extension:// URIs that pertain to my extension.
The avenue that I'm currently investigating is raw string access to the resource contents of the CSS file that I can construct a chrome-extension:// URI for. I have no idea if this will work better than the other attempts, but it seems like it should.

Resources