Which specific characters can be considered as secure in XMLHttpRequest?

For efficiency and obfuscation reasons, I am considering sending game result data in binary form. By doing so, I can reduce the amount of data sent by more than half, resulting in significant savings. Additionally, sending seemingly random bytes rather than distinguishable data adds a layer of obfuscation to the transmission.

Though it's not currently implemented and is just a prototype, my code snippet for converting integer values into binary strings is as follows:

String.fromCharCode.apply(null,somevar.toString(16).split(/(?=(?:..)+$)/).map(function(a) {return parseInt(a,16);}))

I have concerns regarding AJAX and handling binary data. I want to know what range of values would be safe to use in this context. Should I limit myself to 32-255, or play it even safer with 32-127? If I opt for 32-255, adjusting the base in the code snippet to 15 and adding 32 to all numbers may work for me.

However, my primary focus lies in understanding the character range limitations and exploring any potential cross-browser methods (particularly among Canvas-supporting browsers) for transferring binary data.

Answer №1

Using AJAX with binary data is not a problem. When you send an AJAX request, the data is typically posted as form data and encoded as application/x-www-form-url-encode, which only allows letters, numbers, and certain special characters. Even if you convert your data to binary, it will still need to be encoded in this way, so there may not be any space savings gained by doing so.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubleshooting a problem with the Angular dropdown menu

I need assistance with passing information from a dropdown menu into a variable and proceeding with the next steps. Here is the Jsfiddle link var myApp = angular.module('myApp', []); var nextVXPLevelValue = 260; var currentLevel = 10; var VXP ...

What methods can I implement to enhance the capabilities of my API when my response types are defined as interfaces?

My React application requires an extension method to be added on the Product type in order to make refactoring easier. This extension method should include boolean checks such as product.hasAbc() that references the attributes property. Currently, the API ...

The system is currently experiencing issues with its sleep function

I am trying to store all the data fetched from a database in an array called arr_obj, and then use this variable in an async.forEachLimit function. To achieve this, I have implemented an async.series function in my NodeJs code. Everything seems to be wor ...

Button for AJAX Get Request

I need assistance in connecting an AJAX script with a button to send a GET Request when clicked. Can someone help me figure out how to achieve this? <script> var url = "http://myurl.com"; var xhr = new XMLHttpRequest(); xhr.open("GET", url); xhr. ...

Issue with prop inheritance in componentInheritance problem with passing props to

How can I pass the state function setMyChoice as a prop to the GamePlay component in a rock paper scissors Nextjs application? The goal is to produce a value for comparison. In the Gameplay component, I then pass a prop to another component called PlayButt ...

How to eliminate the gap on the first and last slide in Slick.js when centerMode is enabled and infinite is disabled

When using slick.js with centerMode: true and infinite: false, there is currently an issue where a gap appears on the left side of the first slide, as well as on the right side of the last slide. You can see an example of this behavior at https://jsfiddle. ...

How to verify for an empty array within a condition in JavaScript

I can't figure out why my conditional statement to handle the edge case of an empty input array is not working as expected. When I test it with my current example, it returns NaN (no clue why). However, if I change the conditional to if (array.length ...

Is it possible for a JavaScript .execute function to be executed synchronously, or can it be transformed into an Ajax

Currently, I am utilizing the ArcGIS API for Javascript which can be found at this URL: The JavaScript code snippet I'm working with appears to be running asynchronously. Is there a way to convert it to run synchronously or potentially transform it i ...

Tips on updating content at a specific time without the need to refresh the page

I'm working on a digital signage script that needs to be time scheduled. I was able to accomplish this using JavaScript and refreshing the page every 15 minutes. However, my question is, how can I track the time and update the content at specific hour ...

Can WebMethod be used for implementing Auto-Complete feature in ASP.NET AJAX?

My current challenge involves using an auto-complete feature in a web service. When I call a function without a parameter, everything works perfectly: <WebMethod()> _ <Script.Services.ScriptMethod()> _ Public Function GetCompanyNames2() As Str ...

Mastering Knockout: Extracting the selected value from a dropdown and transferring it to an AJAX request

http://jsfiddle.net/smihit_123/kopp8h53/ self.selectedCity.subscribe(function () { alert("this is percentage" + this.percentBonus); }) Is there a way to retrieve the value of an observable property in knockout? For instance, in the jsfiddle ...

Variable unique to the specific function in universal function

Can you explain why the alert displays "AAA" instead of "BBB"? http://jsfiddle.net/Lp4cS/ var z = "AAA"; function xx() { var z = "BBB"; yy(); } function yy() { alert(z); } xx(); ...

How can I locate an element within the body of an if statement?

I am working on a simple JavaScript (jQuery library) if statement to check for the presence of a div element with the class 'video' on the page. If it finds the element, the variable 'arrows' is set to true, otherwise it is set to false ...

Differences between referencing and valuing in arrays in JavaScript

I have noticed an interesting behavior when passing arrays to functions by reference. Even after modifying the array inside a function, the changes do not reflect when logging the array outside the function. For example: let arr = [1, 2]; console.log(arr ...

Navigating through pages in React using Pagination Animations

Attempting to style an active button with a small transition when it receives that attribute has been a challenge. The same issue occurs with the paragraph rendered from the data file. function Pagination() { const [selected, setSelected] = useState(0) ...

Is it possible to align an entire column to the right in the Material UI Data Grid?

I'm currently exploring Material UI and grappling with a specific challenge. Is there a method within Material UI to create a Data Grid with two columns, one left-aligned and the other right-aligned? I've managed to align the headers as desired, ...

Configuring the data source for an autocomplete feature in ReactJS Material UI

For one of my React components, I am utilizing the Material UI autocomplete feature. The data source is retrieved from the server asynchronously and has the following structure: const dataSource = [{ id: 001 firstName: 'fname', lastName: &apo ...

Creating the Apk file for your sencha touch application

Hello there! I'm diving into the world of Sencha Touch as a new user. After installing all the required tools and SDK, I successfully set up the demo example that came with project creation via command line. Now, I'm eager to generate the APK fil ...

Node.js meets Blockly for a dynamic programming experience

Can anyone help me figure out how to run blockly on Node.js and have the code execute directly on the server without having to save the XML first and then run it in the background? I've attempted to use various npm modules but haven't found one t ...

What is the best way to create a reactive prop within this Vue 3 application?

I've been developing a news application using Vue 3 along with the News API. My current focus is on implementing a search feature. Within my App.vue file, I have: <template> <TopBar @search="doSearch" /> <div class=" ...