Extension needs to open a new window with content from string insteadof file. - Mozilla

This is a discussion on Extension needs to open a new window with content from string insteadof file. - Mozilla ; Greetings fellow extension warriors, I have written an extension for our company that performs a bunch of xslt junk and it all works fine. However, the only way for me to display the output is to write it to a ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Extension needs to open a new window with content from string insteadof file.

  1. Extension needs to open a new window with content from string insteadof file.

    Greetings fellow extension warriors,

    I have written an extension for our company that performs a bunch of
    xslt junk and it all works fine. However, the only way for me to
    display the output is to write it to a file in a temp directory, which
    also means I need to move some other files ( images, js, css ) into
    the temp directory also. This is messy and I hate messy solutions.

    Is there a way I can open a widow, browser, dialog etc.. with the
    contents of the output directly, without having to write it to a temp
    directory? Just manipulating the DOM doesn't work because there are
    important transformations that take place in the HEAD portion of the
    document.

    Thanks in advance to anyone who can assist in my quest for cleaner
    solution.

    Down for the cause,
    Andy

  2. Re: Extension needs to open a new window with content from string instead of file.

    > Is there a way I can open a widow, browser, dialog etc.. with the
    > contents of the output directly
    >


    The data: URL scheme is your friend...

  3. Re: Extension needs to open a new window with content from stringinstead of file.

    On Jun 9, 12:33*pm, "Kai Liu" wrote:
    > > Is there a way I can open a widow, browser, dialog etc.. with the
    > > contents of the output directly

    >
    > The data: URL scheme is your friend...


    Thanks for the response, however I seem to be too dense to understand
    it. If you don't mind, please elaborate.

    -Thanks much.
    -Andy

  4. Re: Extension needs to open a new window with content from stringinstead of file.

    On Jun 9, 12:38*pm, andythedestro...@gmail.com wrote:
    > On Jun 9, 12:33*pm, "Kai Liu" wrote:
    >
    > > > Is there a way I can open a widow, browser, dialog etc.. with the
    > > > contents of the output directly

    >
    > > The data: URL scheme is your friend...

    >
    > Thanks for the response, however I seem to be too dense to understand
    > it. If you don't mind, please elaborate.
    >
    > -Thanks much.
    > -Andy


    Hold the phone!! I am not dense, just slow.

    Great solution. I am trying it out now. Thanks a bunch!!!

  5. Re: Extension needs to open a new window with content from stringinstead of file.

    andythedestroyer@gmail.com wrote:
    > On Jun 9, 12:33 pm, "Kai Liu" wrote:
    >>> Is there a way I can open a widow, browser, dialog etc.. with the
    >>> contents of the output directly

    >> The data: URL scheme is your friend...

    >
    > Thanks for the response, however I seem to be too dense to understand
    > it. If you don't mind, please elaborate.
    >
    > -Thanks much.
    > -Andy



    You can use window.open / openNewTabWith or whatever it's called
    (basically, whatever you're currently using) - with a data: URL.

    http://en.wikipedia.org/wiki/Data_URI_scheme has an explanation.

    http://software.hixie.ch/utilities/cgi/data/data generates data: URIs
    from arbitrary strings. Basically, you mostly need to know that you
    URL-escape anything "funny"... shouldn't be too hard.

    ~ Gijs

+ Reply to Thread