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

  • Home
  • SEARCH
  • 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 8360361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:26:41+00:00 2026-06-09T11:26:41+00:00

I am creating a pixel image in javascript, by creating the image tag and

  • 0

I am creating a pixel image in javascript, by creating the image tag and injecting it into the DOM.

The tag looks something like this:

<img style="height:0;visibility:hidden;display:none;" src="http://xyz.com/pixel.aspx">

As you can see, this tag will actually call an ASP.Net page, which will do some processing and write back a pixel like this:

byte[] _imgbytes = Convert.FromBase64String("R0lGODlhAQABAIAAANvf7wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
Response.ContentType = "image/gif";
Response.AppendHeader("Content-Length", _imgbytes.Length.ToString());
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.BinaryWrite(_imgbytes);

What I need is a way to either pass a small piece of data (a GUID value generated in the javascript before the pixel request) to the server or pass some data (a different GUID generated in the pixel aspx code) back to the browser in a way in which it can be picked up by javascript.

Caveats:

  1. Cannot use query string, because the pixel needs to be cachable, and if query string is different the pixel will not be pulled from the browser cache (filename will be different) on subsequent requests.
  2. Cannot use cookies, pixel request is on different root domain than the application, and need this to work in the case where third party cookies are disabled.
  3. Cannot use AJAX, because don’t want to worry about cross-domain issues
  • 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-06-09T11:26:42+00:00Added an answer on June 9, 2026 at 11:26 am

    I resolved this problem myself.

    Instead of an image, I went with a remote script request. So my injected tag looks like this:

    <script async src="http://xyz.com/tracking.aspx"></script>

    Then, in my aspx, I have the following:

    string script = "(function(){Complete('" + guidValue + "');})();";
    
    Response.ContentType = "application/javascript";
    Response.Cache.SetLastModified(DateTime.Now);
    Response.Cache.SetCacheability(HttpCacheability.Public);
    Response.Write(script);
    

    When the response returns to the browser, the Complete method (which resides in a javascript file already loaded by the page) executes with my guid parameter. This enables my page to have full access to the guid.

    Also, since the request URL never changes, the script is properly cached by the browser.

    Voila.

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

Sidebar

Related Questions

(creating a separate question after comments on this: Javascript redeclared global variable overrides old
I'm creating an image editing application for iphone. i would like to enable the
I would like to know a way to generate a single pixel in JavaScript
I'm creating a performance-critical application that implements image manipulation. I'm using some pixel pointers
I'm trying to scale a tiny image (something like 20x40 pixels) to an arbitrarily
I'm creating a image editing program in PHP and Javascript but I can't work
I am creating a tif image with CCIT4 compression. This image is not having
I'm creating a fog feature in my Effect file.. in the pixel shader, I
I am creating an image processing application in C# and trying to take advantage
I have an image with tiles that I am splitting up and creating individual

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.