Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7406999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:38:31+00:00 2026-05-29T05:38:31+00:00

I have a custom browser plugin (built with FireBreath) that will invoke a local

  • 0

I have a custom browser plugin (built with FireBreath) that will invoke a local process on a users machine and pipe stdout back to the browser, to do this i’m running the process through a popen() call and as I read data from the pipe I fire a JSAPI event and send it back to the browser.

In the browser I append the output to a div as pre-formatted text and tell the div to scroll to the bottom.

Code in the browser plugin:

FILE* in;
if(!(in = _popen(command_string, "r")))
{
    return NULL;
}

while(fgets(buff, sizeof(buff), in)!=NULL)
{
    send_output_to_browser(buff);
}

HTML & Javascript/jQuery:

<pre id="sync_status_window" style="overflow:scroll">
    <span id="sync_output"></span>
</pre>


var onPluginTextReceived = function (text)
{
    $('#sync_output').append(text);   
    var objDiv = document.getElementById('sync_status_window');
    objDiv.scrollTop = objDiv.scrollHeight;
}

This method works for the browsers I need it to (this is a limited use internal tool), but it’s frustratingly laggy. My process usually finishes about 30-60 seconds before the output window finishes scrolling. So, how do I make this more efficient? Is there a better way to pipe this text back to the browser?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:38:32+00:00Added an answer on May 29, 2026 at 5:38 am

    There are two optimizations I see potential in:

    1. keep a reference to your pre and span, you keep repeating the dom
      tree search , which is quite costly
    2. Chunk up the output – either on the C side (preferable) or on the JS
      side.

    For quick hack (without removing dependency on jquery, which should be done) could look like

    //Higher or global scope
    var pluginBuffer=[];
    var pluginTimeout=false;
    var sync_status_window=document.getElementById('sync_status_window');
    
    function onPluginTextReceived(text)
    {
        pluginBuffer[pluginBuffer.length]=text;
        if (!pluginTimeout) pluginTimeout=window.SetTimeout('onPluginTimer();',333);
    }
    
    function onPluginTimer()
    {
        var txt=pluginBuffer.join('');
        pluginBuffer=[];
        pluginTimeout=false;
        $('#sync_output').append(text);
        sync_status_window.scrollTop = sync_status_window.scrollHeight;
     }
    

    Adapt to your needs, I chose 333ms for 3 updates/second

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom handler that is returning an image to the browser. The
At the moment I have a custom ActiveX plugin that drops down the usual
I have a FireFox browser plugin that is devloped in C++, that connects to
We have coded a browser plugin. It fires custom events like 'mycustomevent'. I need
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a few models that need to have custom find conditions placed on
hi i would like to create a custom calendar, this calendar will have custom
I have built a web form with some tables and custom controls inside it,
I'm developing a browser plugin and server component system that streams content with a
So I have a custom windows form with a tabbed browser. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.