Lightweight web browser for testing

I have e very specific test setup in mind. I would like to start a web-browser that understands Javascript and can use HTTP proxy, point it to a URL (ideally by specifying it in the command line along with the proxy config), wait for the page to load while listening (in the proxy) requests are generated as web-page is rendered and Javascript is executed, then kill the whole thing and restart. I don’t care about how the page renders graphically at all. Which browser or tool should I use for this? Ideally it should be something self-contained that doesn’t require

Are tags subject to the same CORS restrictions as javascript/fetch calls?

It’s common practice to include scripts from other origins with script tags but when you use fetch calls on other origins then everything must be configured carefully other wise you will get a CORS error. Does the script tag somehow bypass CORS? How does that work? Answer The Same Origin Policy prevents JavaScript reading data from other origins without permission (which is usually provided by CORS). Running JavaScript from other origins is not prevented by the Same Origin Policy (nor is loading stylesheets, displaying images, content in iframes, etc). JavaScript in the page can’t (usually) read sensitive data from other

AWS Upload with multipart/form-data Invalid

I am sending a file to the presignedPOST url to upload to AWS S3 and in other resources I’ve found, to send a file with form-data is to switch to multipart/form-data to send a file. This is the form …

Load json from local file with http.get() in angular 2

I’m trying to load a local json with http.get() in angular 2. I tried something, that I found here on stack. It looks like this: this is my app.module.ts where I import the HttpModule and the …

JS Fetching batch data with HTTP

My RESTful service allows batching requests. I’m trying to combine requests into one batch with help of Fetch API: let req1 = { url: “/cups/count”, options: { method: ‘…

Is there an easy way to determine which hemisphere a user is in?

I’m working on a project which includes seasonal content, and we’re thinking of determining the user’s location to work out what season it is for them. The obvious way of doing this is to Geo-locate …

URL Encode a string in jQuery for an AJAX request

I’m implementing Google’s Instant Search in my application. I’d like to fire off HTTP requests as the user types in the text input. The only problem I’m having is that when the user gets to a space in …

How to spoof site referrer?

I have 2 pages : 1.php and 2.php When the user arrives on 2.php, i want to show on 2.php that the user is arriving from google.com and NOT from 1.php I tried spoofing the header of 2.php using when i do a javascript document.write(document.referrer); it shows me 1.php Any help is appreciated. Answer The http referrer is a request header. The server (PHP) can only set response headers. Thus the only way to spoof a referrer is for the client to do it, usually via some sort of browser plugin.

Checking if a URL is broken in Javascript

This question has been posted on Stack before, but none so specific as to what I’m trying to understand. The simplest way to check if a URL is corrrect to send a http Head request. But how do you use …

When serving JavaScript files, is it better to use the application/javascript or application/x-javascript

The whole question fits in the title. And to add some context: I’m not asking what is the best according to what the specs are saying, but rather what works the best given the mix of browsers deployed …