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 6915141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:26:16+00:00 2026-05-27T09:26:16+00:00

OS X 10.6.8, Chrome 15.0.874.121 I’m experiencing an issue with javascript/jquery: I want to

  • 0

OS X 10.6.8, Chrome 15.0.874.121

I’m experiencing an issue with javascript/jquery: I want to download a header file from base url, then add some more text to it and than spit it out to the client. I’m using the following code:

var bb = new window.WebKitBlobBuilder;
$.get('js/header.txt', function(data) {
   bb.append(data);
   console.log("finished reading file");
});
console.log("just before getting the blog");
var blob = bb.getBlob('text/plain');
// append some more 
saveAs(blob,"name.dxf");

But that fails because getting the file is only finished way after the saveAs(blob) is executed. I know I can fix it with:

var bb = new window.WebKitBlobBuilder;
$.get('js/header.txt', function(data) {
   bb.append(data);
   //append some more
   var blob = bb.getBlob('text/plain');
   saveAs(blob,"name.dxf");
});

But that does not really look attractive: I only want to use the get statement only to append the header to the blob, and if I want to read a footer from the file system, I have to do a get inside a get, and spit out the blob in the inner get

Are there alternative ways to withhold the code after the get statement from executing until the whole file has been successfully loaded?

  • 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-27T09:26:16+00:00Added an answer on May 27, 2026 at 9:26 am

    No.*

    But, if you want it to look more attractive, try to describe semantically what you are trying to achieve and then write functions accordingly. Maybe:

    function loadBlob (loadHeader, loadBody) {
        loadHeader(loadBody);
    }
    loadBlob(function (oncomplete) {
        $.get("js/header.txt", function(data) {
            bb.append(data);
            oncomplete();
        });
    }, function () {
        var blob = bb.getBlob('text/plain');
        // append some more
        saveAs(blob,"name.dxf");
    });
    

    I don’t know, is that more attractive? Personally, I find the original just fine, so maybe mine isn’t any better, but the point is to use sematics.

    * You could use setTimeout to poll and see if the response has been received. That’s technically an alternative, but certainly not more attractive, is it?

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

Sidebar

Related Questions

I've run into a problem with Google Chrome (version: 15.0.874.121 m): when a block's
Chrome display this error in console Unsafe JavaScript attempt to access frame with URL
I use Chrome 15.0.874.106 m My issue may be related to (but not quite
I'm testing Chrome 15.0.874.106m on a dual-core 2.8 GHz Pentium Windows 7 system with
Chrome (or any other webkit browser) throws a ton of these Unsafe JavaScript attempt
Chrome can edit Javascript on the fly, without a full page refresh, similar to
Chrome Developer Tools command console provides a handy command : copy() . From example,
Chrome caches DNS records and tends to ignore changes to the hosts file after
chrome.tabs.create({ 'url': 'https://www.myserver.com/', 'selected': false }, function(tab) { chrome.tabs.executeScript(tab.id, { 'code': doSomething(); }); });
chrome.cookies.get({url:http://www.dahotre.com, name:userid}, function(){}) shows undefined in the console. If I skip the optional empty

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.