Firefox question: Is it possible to create an html iframe which loads a document from my extension using the chrome://? - url

I was wondering if it is possible to create an iframe whithin a HTML document pointing to a XUL document whithin my firefox extension such like:
<iframe src="chrome://myextension/content/document.xul"/>
I am currently getting security errors when trying to do this. I've already tried the contentaccessible=yes flag in my chrome.manifest but it didn't work.
Is there any workaround to get this working?
Thanks.

No, web pages are generally not allowed to load chrome documents. contentaccessible=yes refers to images and scripts that are less regulated security-wise (they can also be used across domains). However, your extension has permission to load chrome documents - even into a content page. So doing something like this from your extension will work:
window.content.frames[0].location.href = "chrome://myextension/content/document.xul";
Not sure whether this will help you, depends on what you are trying to achieve.

Related

TYPO3 8.7 is it possible to output a specific page with multiple url path s

I'm trying to integrate a vue.js application into a typo3 page.
I have a full functional TYPO3 instance where I can create own pages, edit the content and more. Now I want to add an existing vue.js application within this page.
Therefore I created an extension which added all necessary resources (js, css) and added an own content type which controls the integrations and configurations. The content type outputs a vue.js entry point. So far everything works. Smaller vue.js applications works as they should.
Now comes the challenge: When I want to create a more complex application which relies on the router functionality, I run into a problem.
Let's assume, I integrate my application into the page /shop and my application tries to render a product under /shop/product/some-id. This doesn't work. The URL processing is done by TYPO3 (as designed).
I tried to find a solution within the documentation but I'm not sure what I should search. I need a way to output the same page (/shop) regardless the following path. Does someone have a hint?
I found a solution. Within TYPO3 v8 is it possible to use the realurl extension for this purpose.
It is possible to define an own decode preprocessing function and analyse the current url.
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['decodeSpURL_preProc'][] = RealUrlManipulation::class . '->decodeSpURL_preProc';
Within this method is it possible to change the url for TYPO3 inner processing and set it to an known url.

CSP and browser extensions

According to Wikipedia in "Browser Add-Ons and Extensions Exemption" section:
CSP should not interfere with the operation of browser add-ons or
extensions installed by the user...
But unfortunately it is blocking external scripts, injected by my add-on.
I can always put this injected code in to the content script. But I'm wondering if there is another way to overcome this.
You should indeed put your code into a content script. If you insert a <script> tag into a page then it works exactly the same as if the web page itself inserted it. The browser has no way of knowing that this code belongs to your extension. What's worse, this code isn't safe from manipulations by the webpage - e.g. the webpage can redefine window.alert() method and your code won't be able to show messages. Extension code and content scripts on the other hand aren't affected by this, these see only the raw DOM objects without any JavaScript-induced changes.

Using processing.js inside a Firefox extension

I am curious to know if anyone has been successful using processing.js inside a Firefox extension. I am aware of the difficulties of using external libraries inside extensions and the fact that it has to be loaded in a way that will not pollute the global namespace, conflict with other extensions or Firefox itself.
But with those concerns aside, I wonder if there is anything else that should be considered before attempting it (performance, etc).
I am thinking about using it on a new window, in xhtml loaded from the chrome. Any experiences, ideas and suggestions?
I had the same doubt right now, but I think it can be done, we just hace to include processing.js file in content folder of our .xpi

Is there any way to embed a pdf file into an html5 page?

I want to have a web page coded with HTML5, and I want to be able to put a pdf file onto this page so you can view it without having to click on any links to download it separately. Anyone know how to do this?
I want it to keep the text, images, and layout of the pdf file also. If that weren't the case I would just use an image. Thanks!
Edit: This will be hopefully going onto the ipad. So it won't support adobe. I need to just find a way to somehow make the pdf file show up in an html5 page without using a viewer. I want to keep all of its layers. It doesn't have to stay a pdf file when its on the page, I just need to find a way to transfer all of those layers there without having to do this manually with divs for each image, paragraph, etc.
I don't think this is possible without using Flash. Instead, you might want to convert the PDF to a different format (HTML for example) that can be rendered by the browser. There are tools that can do this from the command line, so making a script to do it on your site won't be too difficult.
You can use the embed tag like this:
<embed src="/path/to/your/file.pdf" />
Maybe you could convert the pdf to images on the server and display the images instead of the original pdf. As far as i know, Apache pdfbox can be used to do such a convert.
A little bit late and maybe issuu is gonna fix it soon but for now you can embed with issuu.com using an iframe and your magazine address ending in ?mode=mobile. Tested in ipad:
<iframe width="850px" height="580px" src="http://www.issuu.com/your_username/docs/your_magazine_name?mode=mobile" frameborder="0" allowfullscreen></iframe>
I would like same mobile version loading in desktop so there is no advertising. If you know how to make the browser to think it's an ipad let me know.
This code would directly embed a pdf viewer in a webpage
<object data="path to pdf " type="application/pdf" width="100" height="100">
<p>Alternative text - include a link to the PDF!</p>
</object>
If you are using ASP.NET, this link may be of interest to you.
Browser Based PDF Viewing And Editing
Hosted entirely on your server,
activePDF Portal is an ASP.NET
WebControl that enables your users to
interactively view and modify PDF
documents from any source - adding
comments, form fields, bookmarks, and
more – directly from within a standard
web browser, without requiring any
client-side software such as Adobe
Reader or Flash, or the use of ActiveX
controls.
- http://portal.activepdf.com/
PDFObject looks promising, but it doesn't work on iPads at the moment.

Firefox Extension - Need a specific div to ignore xhtml errors (mismatched tag, etc)

My firefox extension loads content from a 3rd party site into an overlay panel. This content is user generated and sometimes will, for instance, have an image tag that does not close which causes a mismatched tag error to be thrown and the extension fails. Is there any way I can sandbox this content so that these kind of errors are not an issue? I was thinking maybe load the content into a blank iframed page.. but was wondering if there might be a cleaner solution.
Unfortunately, unless you're getting back XML, there is no XPCOM solution for parsing. Your best bet is what you suggested - placing the content in an iframe.
You can find some more discussion about the topic at: http://www.mozdev.org/pipermail/greasemonkey/2005-April/001255.html
Your guess about an iframe was correct, there's no better way to do it (as of Firefox 3.5): Parsing HTML From Chrome on MDC

Resources