Skip to main content

Posts

Injecting React components into webpages using content scripts in browser extensions

I am creating a React-based browser extension and I am trying to inject a React component into webpages using content scripts. However, it seems like using React or ReactDOM prevents the content script from loading. Is there any to get around this issue? This is the code that I currently have. It seems like the content script only loads when React and ReactDOM is not used since nothing is logged to the console. import NavBar from "./NavBar"; import React from 'react'; import ReactDOM from 'react-dom'; console.log('Content script is running'); const container = document.createElement('div'); document.body.appendChild(container); ReactDOM.render(<NavBar />, container); Via Active questions tagged javascript - Stack Overflow https://ift.tt/yZtDo8N

Cannot read properties of null in SPA javascript when reading a form in another route

I have the below single page application, but when I go to the login route, and submit, the event listener for the form is not triggered And I get this error : Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') at login?session%5Bemail%5D=fdf%40gmail.com&session%5Bpassword%5D=dfdf&session%5Bremember_me%5D=0:34:6 This is the home page <!DOCTYPE html> <html> <head> <title>Vanilla SPA Router</title> <meta charset="UTF-8" /> <link rel="stylesheet" href="css/styles.css" /> <link href="https://cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.min.css" rel="stylesheet" /> </head> <body> <div id="root"> <nav id="main-nav" class="sidebar"> <a href="/" onclick="route()">Home<

Javascript parse RSS which includes German characters

I am trying to load rss which has German characters included (ö, ä, ü...) xhrRequest.responseText already contains converted characters (\u00f ...) Without manually replacing is there to force right encoding so original characters stay visible? var url = 'https://apolut.net/feed/podcast/' xhrRequest = new XMLHttpRequest(); xhrRequest.onreadystatechange = function() { if (xhrRequest.readyState == 4) { } } xhrRequest.onerror = function(e) { }; xhrRequest.open('GET', url); xhrRequest.setRequestHeader("Content-Type", "text/xml"); xhrRequest.send(); I do have utf on the top of page: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Via Active questions tagged javascript - Stack Overflow https://ift.tt/Aosi8g1

Using pycord and tkinter together returning error

RuntimeWarning: coroutine 'send' was never awaited self.tk.mainloop(n) RuntimeWarning: Enable tracemalloc to get the object allocation traceback I keep getting the above error on my pycord code. I can't figure out why and have looked at multiple discussions. Here is the code. root = Tk() frm = ttk.Frame(root, padding=10) frm.grid() server = StringVar() channel = StringVar() text = StringVar() e1 = Entry(frm, textvariable=server) e1.grid(column=0, row=0) e1.insert(0, 'Server') e2 = Entry(frm, textvariable=channel) e2.grid(column=0, row=1) e2.insert(0, 'Channel') e3 = Entry(frm, textvariable=text) e3.grid(column=0, row=2) e3.insert(0, 'Text') async def send(): for guild in bot.guilds: if guild.name == server.get(): for channel1 in guild.channels: if channel1.name == channel.get(): await channel1.send(text) ttk.Button(frm, text="Send", command=send).grid(column=0, row=4) def run

Are timing requirements in webRtc between calling setRemoteDescription and addIceCandidate?

I have implemented webrtc in 2 browsers that physically work on one local machine (one browser I will call as "local", another - "remote"). The browser - Firefox 112.0.1, TURN, STUN servers are not used. All strings (offer, answer, ice candidates) are transferred from one to another browser manually (slow transfer - via copy and paste). "Remote" gets an offer from the "local" and processes it by rtc2_RegisterRemoteOffer (see code below). This function creates answer of the "remote". Then: (1) the negotiationneeded event fired on the "remote", (2) because of (1) "remote" creates offer and generates it's own ice candidates (up to here neither "local" nor "remote" ice candidates I didn't transfer to each other). (3) Then after few seconds on the "remote" iceconnectionstate fired with the status failed . The questions are: What may be a reason of iceconnectionstate gets faile

Form is returning null without any reason [closed]

thanks to give me your time. I actually coding a login page but i can't write form.addEventListener() When i console.log(form) it return null and i don't know why For the js side : const form = document.getElementById("form"); console.log(form) form.addEventListener('submit', (event) => { event.preventDefault console.log(event) console.log(form) }) For the html side : [...] <form id="form"> <label for="email"> Entrez votre Email : </label> <input id="email" type="email" name="email" placeholder="Email ..." required> <label for="mdp"> Entrez votre Mot de Passe : </label> <input type="password" name="password" id="mdp" placeholder="Mot De Passe ..." required> <input type="submit" name="envoyer" id=&quo

React Native npx create-react-app Problem

My PowerShell(Terminal) Warn, i don't used npm install or any one just tried npx create-react-app NKE command: PS C:\Users\berk.BERK-PC\React Native> npx create-react-app NKE npm WARN using --force Recommended protections disabled. npm WARN using --force Recommended protections disabled. npm ERR! code ENOENT npm ERR! syscall lstat npm ERR! path C:\Users\berk.BERK-PC\React Native\'~ npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\berk.BERK-PC\React Native\'~' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: C:\Users\berk.BERK-PC\AppData\Local\npm-cache\_logs\2023-12-28T21_08_04_536Z-debug-0.log PS C:\Users\berk.BERK-PC\React Native> The Loc File: 0 verbose cli C:\Program Files\nodejs\node.e