How to get dynamic content from website with C#

I’m looking to obtain informations automatically from a website via a C# application. The problem is that these informations are dynamic. I can’t retrieve them from the page’s source code. Even with F12 on my browser, I find a way to indentify these informations!

I’ve tried to obtain them using the Nuget Selenium package, but I can’t get the information I want. I can’t use the body content because all the informations are dynamic, and I haven’t found a Select that works because the page doesn’t have specifics id.

Here are two examples:
https://web.idle-mmo.com/wiki/items?page=1&sort_by=id_asc
On this page, I’d like to get the name of each object and the link to its page, as well as be able to “click” on the button to display page 2, because the direct link to page 2 leads to page 1.

https://web.idle-mmo.com/wiki/items/mystic-sword/ZjlPA8v9NMaXNEyMe2Oa?same_window=true
Here I’d like to retrieve informations on the latest sales as well as the price history for the last few days (mouseover the graphic).

In both cases, I can’t figure out how to retrieve what I need.

I’ve tried quite a few things but nothing worked, so here’s the embryonic code that retrieves the source code but doesn’t work in my case.

 private void TestReadPage()
 {
      IWebDriver driver = new ChromeDriver();
      driver.Navigate().GoToUrl("https://web.idle-mmo.com/wiki/items/mystic-sword/ZjlPA8v9NMaXNEyMe2Oa?same_window=true");

      // Getting the body but useless
      var body = driver.FindElement(By.TagName("body")).Text;

      // No result trying to get last sold but just the list, not the average sold price in the graphic
      var lastsold = driver.FindElements(By.ClassName("!border-t-0"));

        driver.Quit();
 }

PSQL connection to Node.js issue

So I am able to connect to my psql database through the command prompt using the prompt (psql -h localhost -p 5432 -U postgres -d Luxe-Hotel) and putting in the password but I am unable to connect through node.js.

import express from "express";
import cors from "cors";
import pkg from "body-parser";
import bcrypt from "bcrypt";
import knex from "knex";
import handleRegistration from "./controllers/handleRegistration.js";
import handleSignIn from "./controllers/handleSignIn.js";

const db = knex({
    client: 'pg',
    connection: {
        host: 'localhost',
        port: 5432,
        user: 'postgres',
        password: 'xxxxxxxxxx',
        database:'Luxe-Hotel'
    },
    pool: { min: 0, max: 7 }
});

db.raw('SELECT 1')
  .then(() => console.log('PostgreSQL connected'))
  .catch(err => console.error('PostgreSQL connection error:', err));

So when I start the server I get the error:
“PostgreSQL connection error: AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1122:18)
at afterConnectMultiple (node:net:1689:7) {
code: ‘ECONNREFUSED’,
[errors]: [
Error: connect ECONNREFUSED ::1:5432
at createConnectionError (node:net:1652:14)
at afterConnectMultiple (node:net:1682:16) {
errno: -111,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘::1’,
port: 5432
},
Error: connect ECONNREFUSED 127.0.0.1:5432
at createConnectionError (node:net:1652:14)
at afterConnectMultiple (node:net:1682:16) {
errno: -111,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘127.0.0.1’,
port: 5432
}
]
}”
I’ve turned off the firewalls, check the pgsl confiq files for listening address and ports, went over the config settings in my code and still no luck.

Copy/Paste Limit

Please Help, I am looking for a code. I want to bypass copy/paste character limit? I don’t know it that’s the correct term but, I can only paste like maybe 10 letters on this website. And I want to paste more than that. What code should I use? I am using firefox. Please if anyone know. I would really appreciate it. Thank you!

I haven’t tried anything yet. I can’t find the solution.

Apexcharts: How to disable scroll/wheel zoom but keep click/select zoom?

Regarding the Apexcharts chart zoom in/out functionality. How do you disable zoom when the pointer hovers over the graph and the mouse wheel is used, while still maintaining the click and select area zoom capabilities?

 chart: {
  zoom: {
      enabled: true,
      type: 'x',  
      autoScaleYaxis: false,  
      zoomedArea: {
        fill: {
          color: '#90CAF9',
          opacity: 0.4
        },
        stroke: {
          color: '#0D47A1',
          opacity: 0.4,
          width: 1
        }
      }
  }

}

Counting cells with a specific class in JavaScript

I have a HTML table and the following script to add a specific class to the cells, depending on their content.

Now, I would like to count only the items with class = active and trigger a modal (autoOpen: true) with the number of those items.
Any suggestions?

<script>
$('td').each(function() {
var $this = $(this)
  if ($this.text().match(new RegExp(/^[0-9][A-Z]/)) !== null ) {
    $this.addClass('active');
  }
  if ($this.text().match(new RegExp(/^c[0-9]/)) !== null ) {
    $this.addClass('none');
  }
});
</script>

Import kv module to cloudflare worker with javascript

I am trying to import the kv module to my cloudflare worker (i.e. to do put and get requests to it). I created it with wrangler (v3.78.12). I just dont know how to import it lol

From some research, I have tried

import { KVNameSpace } from '@Cloudflare/kw-namespace'
import { KVNameSpace } from 'cloudflare:kv'
import { KV } from 'cloudflare-workers-kv'

none of these worked

If anyone knows what it is, please let me know, as well as letting me know what to do after that (i.e. how to actually do the get and put requests)
I am very new to backend developing
If you need my code, I can give it to you

React-Native undefined browser tab titles? react-router-dom Navigate

We are getting an issue using react-native where when we navigate to another page using the react-router-dom, it sends you to the correct page, but the tab title displays undefined. Once you refresh the page, however, it displays the correct screen title. Here is an example of where we navigate to the /login page:

import { Navigate } from "react-router-dom";
import { getItem } from "../utils/localStorageUtil";
import WebMain from "./WebMain";
import { HomeStack } from "./WebMain";

const AuthContainer = () => {

  const token = getItem('token');

  return token ? <WebMain stack={HomeStack} /> : <Navigate to="/login" replace />
}

export default AuthContainer;

Here is what our routes look like:

import * as React from 'react';
import MobileMain from './navigation/MobileMain';
import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
import ViewPage from './Components/ViewOnlyComponents/ViewPage';
import WebMain, { GalleryStack, LibraryStack, ProfileStack, LoginStack, RegisterStack, VerificationStack, CameraConnectionsStack } from './navigation/WebMain';
import { MenuProvider } from 'react-native-popup-menu';
import { NavigationContainer } from '@react-navigation/native';
import { DataProvider } from './Components/ContextProvider';
import AuthContainer from './navigation/AuthContainer';

const PageNotFound = () => (
  <div>
    <h1>Page Not Found</h1>
    <p>Oops! The page you're looking for does not exist.</p>
  </div>
);

const PathRouter = () => (
  <Router>
    <Routes>
      {/* Route with URL parameters */}
      <Route path="/view-photos/:parameter1/" element={<ViewPage />} />
      {/* Route for when "/view" parameter is not present */}
      <Route path="/" element={<AuthContainer />} />
      <Route path="/home" element={<Navigate to="/" />} />
      <Route path="/login" element={<WebMain stack={LoginStack} />} />
      <Route path="/register" element={<WebMain stack={RegisterStack} />} />
    </Routes>
  </Router>
);

Here’s what the LoginStack looks like:

export const LoginStack = () => (
  <Stack.Navigator screenOptions={{ headerShown: false }}>
    <Stack.Screen name="Login" component={LoginScreen} />
  </Stack.Navigator>
);

So the tab should display the name “Login”. When we redirect, or even copy links to other pages, it initially sets the tab title as undefined. Once you refresh, it puts the correct name there. Any insight as to why and how we can fix this?

Expected to redirect to a page using Navigate or useNavigate from the dom package, and have it display the tab name correctly. It initally doesn’t on the redirect and only displays undefined. After a refresh of the browser page, it displays the correct name

How to dynamiclly update table row based on user input

I’m trying to create a dynamic HTML table that updates its rows based on user input. The table should display a list of items with their corresponding prices.

HTML:

<table id="item-table">
  <thead>
    <tr>
      <th>Item</th>
      <th>Price</th>
    </tr>
  </thead>
  <tbody>
    <!-- rows will be generated dynamically -->
  </tbody>
</table>

<input type="text" id="item-name" placeholder="Enter item name">
<input type="number" id="item-price" placeholder="Enter item price">
<button id="add-item">Add Item</button>

JavaScript (jQuery):

$(document).ready(function() {
  $('#add-item').click(function() {
    // Get user input
    var itemName = $('#item-name').val();
    var itemPrice = $('#item-price').val();
    
    // Create new table row
    var newRow = $('<tr>');
    newRow.append($('<td>').text(itemName));
    newRow.append($('<td>').text(itemPrice));
    
    // Add row to table body
    $('#item-table tbody').append(newRow);
  });
});

**Problem:
**
When the user clicks the “Add Item” button, the new row is added, but I want to:

  1. Validate user input (e.g., check if item name is not empty and price is a positive number).
  2. Update the table rows dynamically when the user changes the input fields.
  3. Remove duplicate item names.

~~- Using change event on input fields, but it doesn’t update the table rows.~~~~

  • Using blur event on input fields, but it doesn’t validate input

Any guidance or code snippets would be greatly appreciated!

Edit: I’ve updated the code to use change event, but still facing issues.

Would you like me to modify or add anything to this question?

Uncaught TypeError: this[(“on” + t)] is not a function in Razorpay checkout.js

Question:

I’m integrating Razorpay into my React application, and the payment process is mostly working. However, after the payment is completed, I receive the following runtime error from the Razorpay script:

Uncaught TypeError: this[("on" + t)] is not a function
    at Ye.onmessage (https://checkout.razorpay.com/v1/checkout.js:1:158735)

Details:

  1. The Razorpay modal opens correctly, and payment works as expected.
  2. The error appears after the payment is completed and the handler function is triggered.
  3. I’m using Razorpay’s test key, and here is my setup for loading the script and opening the payment modal:
const loadScript = (src) => {
  return new Promise((resolve, reject) => {
    const script = document.createElement("script");
    script.src = src;
    script.async = true;
    script.onload = () => resolve(true);
    script.onerror = (error) => reject(new Error("Script load failed"));
    document.body.appendChild(script);
  });
};

const displayRazorpay = async () => {
  try {
    const scriptLoaded = await loadScript("https://checkout.razorpay.com/v1/checkout.js");

    if (!scriptLoaded) {
      console.error("Failed to load Razorpay SDK.");
      return;
    }

    const options = {
      key: "api_key",  // Using test key
      amount: 50000,  // Amount in paise (500 INR)
      currency: 'INR',
      name: "Shop It",
      description: "Test Payment",
      handler: function (response) {
        console.log("Payment successful, Payment ID:", response.razorpay_payment_id);
      },
      prefill: {
        name: "Test User",
        email: "[email protected]"
      },
      theme: {
        color: "#F37254"
      }
    };

    const paymentObject = new window.Razorpay(options);
    paymentObject.open();
  } catch (error) {
    console.error("Error in Razorpay setup:", error);
  }
};

What I’ve Tried:

  1. I’ve ensured that the handler function is correctly defined and the Razorpay payment modal opens and closes as expected.

  2. I also tried wrapping the navigate() function (from react-router-dom) in a setTimeout to delay navigation after payment, but the error persists.

Request:
Does anyone know what could be causing the this [("on" + t)] is not a function error in the checkout.js file from Razorpay, or how to debug it?

i have this div and i want in printing mode to make this div be at bottom of my page and on the last page of my printing

Hello there I have certification system management and I want to show a footer or a section at the bottom of my page on the last page, I tried to fix the section but it shows in I tried some javascript codes but it still gave me the problem so how can I resolve this problem?

this enter image description here is an example of how I want to stick the selected red area to be in the yellow era and only show it on the last page in the footer but not show it in all pages

what I want to do is print the signature on the last page and at the bottom of the page.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="{{ asset('css/withMarks.css') }}">
    <title>Certification
        @if (isset($student))
            {{ $student->name }}
        @endif
    </title>
</head>

<body style="position: relative;">
    <button class="non-print-view btn btn-primary">
        <a href="{{ route('admin.students') }}">زڤرین</a>
    </button>
    <button type="button" onclick="printView()" id="printButton" class="non-print-view btn btn-primary">
        چاپكرن
    </button>
    <section id="printSection">
        @php
            $head = 10;
            $mark = 0.6; // init value
            $noteSpace = 0.4;
            $otherMargin = 5;
            $totalSpace = $head;
            $break = true;
        @endphp
        <header class="container">
            <div class="header-left">
                <img src="{{ asset('assets/images/logo.png') }}" alt="">
                <div>
                    <h1>زانـکـۆیـا دهـوك</h1>
                    <p>رێڤەبەریا تومارکرنا گشتی</p>
                </div>
            </div>

            <div class="header-right">
                کومارا ئیراقێ، هەرێما کوردستانێ <br>
                سەروکاتیا جڤاتا وەزیران <br>
                وەزارەتا خواندنێن باڵا و ڤەکولینێت زانستی
            </div>
        </header>

        <section class="transcript-head container">

            <div class="transcript-head-date">
                <div class="row">
                    <div class="row-head">ژمارە: </div>

                    @php
                        $englishLettersToArabic = [
                            'B' => 'ب',
                            'M' => 'م',
                            'D' => 'د',
                            'C' => 'چ',
                        ];
                        $newCertificateUniqueId = strtr($certificate->certificate_unique_id, $englishLettersToArabic);
                    @endphp

                    <div>{{ $newCertificateUniqueId }}</div>
                </div>
                <div class="row">
                    <div class="row-head">مێژوو: </div>
                    <div>
                        <span>{{ date('Y/m/d') }} م</span>
                        <span>{{ getKurdishYear('ku') }} ك</span>
                    </div>
                </div>
            </div>

            {{-- <div class="transcript-head-title">
                <h2>بەلگەناما نمرا</h2>
            </div> --}}
            <div class="transcript-head-image">
                <img src="{{ asset('storage/photos/students/' . $student->image) }}" alt="">
            </div>

        </section>


        <section class="transcript container">
            <h2>بەلگەناما نمرا</h2>
            @if (isset($transcript))
                @if (str_contains($transcript, $student->getNameByLang('ku')))
                    {!! str_replace(
                        $student->getNameByLang('ku'),
                        '<strong>' . $student->getNameByLang('ku') . '</strong>',
                        $transcript,
                    ) !!}
                @endif
            @endif
        </section>


        <section class="marks container">
            @foreach ($StudentSubjects as $year => $courses)
                @if ($loop->iteration > 2 && $loop->iteration % 2 == 1 || $loop->iteration > 3 && $loop->iteration % 6 == 0)
                    <div style="page-break-after: always;"></div>
                <script>
                    var header = document.querySelector('.transcript-head');
                    header.style.paddingTop = '2cm';

                     
                </script>
                @endif
                {{-- <div style="page-break-after: always;"></div>
                @endif --}}
                @php
                    // Determine the number of subjects for each course
                    $subjectsCounts = array_map('count', $courses);
                    $maxRows = max($subjectsCounts); // Find the course with the most subjects
                @endphp
                {{-- {{var_dump($totalSpace >= 16, $totalSpace)}}
                @if ($totalSpace >= 27 && $break)
                    <div style="page-break-after: always;"></div>
                    @php $break = false; @endphp
                    <div style="padding-top: 1cm;"></div>
                @endif --}}
                <h3>سالا
                    {{ numToText($loop->iteration, 'krd') }} {{changeYearToDoubleYear($year)}}</h3>

                @if (count($courses) == 2)
                    <div class="mark-row">
                @endif

                @foreach ($courses as $course => $subjects)
                    @php
                        $totalSpace += count($subjects) * $mark;
                    @endphp
                    <div>
                        <h4> وەرزێ {{ numToText($loop->iteration, 'krd') }}</h4>
                        <table>
                            <thead>
                                <th>بابه‌ت</th>
                                <th>ژمارا یه‌كا</th>
                                <th>ب هەژمار</th>
                                <th>ب نڤیسین</th>
                                <th>پلە</th>
                            </thead>
                            <tbody>
                                @foreach ($subjects as $subject)
                                    <tr>
                                        <td>{{ $subject['subject'] }}</td>
                                        <td>{{ $subject['unit'] }}</td>
                                        <td>{{ $subject['attempt'] == 1 ? '' : '+' }}
                                            {{ $subject['mark'] }}</td>
                                        <td>{{ changeStudentMarkFigureToText($subject['mark'], 'krd') }}</td>
                                        <td>{{ changeMarkToGrade($subject['mark'], 'krd') }}</td>
                                    </tr>
                                @endforeach
                                @php
                                    // Calculate how many empty rows are needed to match the course with more subjects
                                    $emptyRowsNeeded = $maxRows - count($subjects);
                                @endphp

                                @for ($i = 0; $i < $emptyRowsNeeded; $i++)
                                    <tr>
                                        <td colspan="5">&nbsp;</td>
                                    </tr>
                                @endfor
                            </tbody>

                        </table>
                    </div>
                @endforeach

                @if (count($courses) == 2)
                    </div>
                @endif
            @endforeach

        </section>

        @php
            $totalSpace += count($notes) * $noteSpace + $otherMargin;
            $signatureMargin = 59 - $totalSpace;
        @endphp

        <section class="notes container">
            <div>

                <h3>تێبینی</h3>
                <ul>
                    <li>
                        <pre>پله‌: 50-59 په‌سه‌ند     60-69 ناڤنجی     70-79 باش     80-89 زۆر باش     90-100 هه‌ره‌ باش</pre>
                    </li>
                    @foreach ($notes as $note)
                        <li>{{ $note }}</li>
                    @endforeach
                </ul>
            </div>

            <div class="qrCode">
                <div id="qrcode">

                </div>
            </div>
        </section>

        <section class="avgMarks container">

            <h3>تێکرا هوسا دهێتە دەرئێخستن:</h3>
            <ul>
                <li>
                    <div>ساڵا ئێکێ 10٪</div>
                    <div>ساڵا دووێ 20٪</div>
                    <div>ساڵا سیێ 30٪</div>
                    <div>ساڵا چوارێ 40٪</div>
                </li>
            </ul>

        </section>

        {{var_dump($signatureMargin)}}

        <section style="margin-top: {{$signatureMargin}}cm;" class="signature container">

            <div>
                <h2>پ.هـ.د. نه‌به‌ز ابراهیم محمد</h2>
                <p>هاریكارێ سه‌رۆكێ زانكویێ بۆ كاروبارێن قوتابیان</p>
            </div>

            <div>
                <h2>ديار هاشم مالو</h2>
                <p>توماركارێ زانكویێ</p>
            </div>

        </section>

        <footer>

            <div>[email protected]</div>

            <div>www.uod.ac</div>

        </footer>

        <img src="{{ asset('assets/images/logo1.png') }}" alt="" class="watermark">


    </section>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/qr-code-styling.js"></script>
    <script>
        const qrCode = new QRCodeStyling({
            width: 120,
            height: 120,
            data: "{{ route('admin.qr', ['token' => $certificate->token]) }}",
            type: "image",
            image: "{{ asset('assets/images/logo.png') }}",
            dotsOptions: {
                color: "#005baa",
                type: "rounded"
            },

            imageOptions: {
                crossOrigin: "anonymous",
                margin: 0,
                imageSize: 0.8
            }
        });

        qrCode.append(document.getElementById("qrcode"));
    </script>
    <script type="text/javascript">
        var replaceDigits = function() {
            var map = ["&#1632;", "&#1633;", "&#1634;", "&#1635;", "&#1636;", "&#1637;", "&#1638;", "&#1639;",
                "&#1640;", "&#1641;"
            ];
            document.body.innerHTML = document.body.innerHTML.replace(/d(?=[^<>]*(<|$))/g, function($0) {
                return map[$0];
            });
        }
        window.onload = replaceDigits;
    </script>
    <script>
        function printSection() {
            const printContents = document.getElementById('printSection').innerHTML;
            const originalContents = document.body.innerHTML;

            document.body.innerHTML = printContents;
            window.print();
            document.body.innerHTML = originalContents;
        }

        // print button


        document.querySelector('button').addEventListener('click', printSection);

        function printView() {
            window.print();
        }
    </script>

</body>

</html>
@media print {
    .non-print-view {
        display: none;

    }


    footer {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        justify-content: space-between;
        padding: 5px 1cm;
        background-color: #c2c3c5;
    }

    .for-print {
        display: block;
    }

    @page {
        size: A4;
        margin: 0mm;
    }



    .watermark {
        background-repeat: no-repeat !important;
        background-position: center !important;
        position: fixed !important;
        opacity: 0.1 !important;
        top: 50% !important;
        left: 50% !important;
        max-width: 440px;
        max-height: 540px;
        transform: translate(-50%, -50%) !important;
        z-index: 9999 !important;
        display: block !important;
    }

    .qrCode {
        align-self: end;
        padding-left: 10px !important;
    }


}


@font-face {
    font-family: 'AKFont';
    src: url("{{ asset('assets/fonts/public/assets/fonts/arabic.ttf') }}");
}

/* --------------- Start: Signature --------------- */

.signature {
    display: flex;
    justify-content: space-between;
    margin: 2cm 1cm;
    padding: 1cm 0;
}

.signature h2 {
    font-size: 15px;
    font-weight: bold;
}

.signature p {
    font-size: 14px;
    font-weight: bold;
}

/* --

I have tried to fit it with javascript or CSS but I was not able to solve this problem so if there is anyone to help me I would be glad

I have a Remote Access Trojan (RAT) On my gaming PC [closed]

So a few months ago my friend told me to download this winrar file I downloaded it and got a Remote access Trojan on my PC

So I resetted my gaming pc and that didn’t work he still had access and my friend that had access showed me how to delete the file like where the file was so I went into the directory where he told me where the Remote Access Trojan was and after I got into the directory he told me to delete it so I deleted the file after that his window of the webcam that he saw me on like closed and that was proof that it got deleted so yeah that was during my friend telling me how to delete the file during the discord call and after I deleted the file the webcam like the window he was watching me on like closed I bet he still has access to my system but I can’t get rid of it so yes now after I deleted the file the webcam window closed which I saw during the discord call because he was sharing his screen and I saw that I deleted the Remote access Trojan his webcam window closed after that I couldn’t delete the other files because there were like restricted you couldn’t delete them if you know what I mean like when you can’t delete them so yeah those were the only ones I was able to delete after that I ended the discord call thinking that the remote access Trojan was gone but whenever I open discord on my phone my friend still switches back to idle when he’s on his phone it’s sus it just looks sus like he’s watching me so how do I fully get rid of the rat he has access to my phone and my pc the router is what the devices appear on now yes all devices have a login which you most like know the purpose of them anyway… yeah idk how he knows the login through my phone because this all started on my computer and now he has access through my phone my uncle is currently not currently but he might fix my computer soon currently he said my pc is not on it’s like yk he’s not fixing that yet so he can’t see so my uncle said the thing I should do well he’s being a programmer coder for more than 20 years so he’s had like a job that was he’s job yk but yeah so he told me to I don’t know how to do this but he said that I should sandbox it with like a internet like sandbox it and like he said you have to sandbox the right way and after that he said after that I should pull out the hard drive or motherboard out of my pc and see if there’s anything wrong with it according to my uncle replacing may be necessary depending but yeah. Generally what should I do if I have a Remote Access Trojan on my gaming pc because now idk how he has access to my phone I don’t know if that is from my computer or if it’s through the router I just don’t know it’s actually scary when you think about it I just want whatever he knows what he’s spying on me gone!

Next.js – Dynamically change Body’s background image based on screen size

I’m using Next.js 14.2.12 and I’m trying to create a login page with different background images for the <body> element based on screen size. Here’s the basic structure of my src/app/login/page.tsx component:

"use client";

const Login: React.FC = () => {
  return (
    <>
      <p>Some text</p>
    </>
  );
};

export default Login;

Is there a built-in way in Next.js to achieve this? Or do I need to use CSS media queries and JavaScript to dynamically update the background image? If so, how can I do this efficiently without affecting performance?

I am working with the following four screen sizes and I want to apply four different images of PNG format.

enter image description here

Microsoft Authenticator Approval Workflow in Web App

I’m currently working on a web application that integrates Microsoft authentication using MSAL and Azure AD. My goal is to implement a workflow where a user can approve or reject a request directly through Microsoft Authenticator.

Here’s the flow I envision:

1.- User logs in to the web app using their Microsoft account.
2.- When a specific action requires approval (e.g., accessing sensitive data), the application should trigger an MFA request.
3.- A notification should be sent to Microsoft Authenticator, prompting the user to approve or reject the action.
4.- The web app should wait for the user’s response to determine if the action is approved or rejected.

I’ve set up the necessary authentication and can retrieve user information, but I’m unsure how to properly initiate the MFA request to send the notification to Authenticator and handle the approval response.

Does anyone have experience with this workflow? Are there any specific API calls or configurations I should be aware of to accomplish this?

Thank you for your help!

I currently have the login implemented and can access user information. However, I have not been able to issue a request for a notification to be sent to Microsoft Authenticator.

Fetch twice recursively to do speed rate calculations with response from server

My server (Python – Django) response is a JSON object containig rx and tx expressed in bytes from a networking router, which then I need to show to the user as Download speed in Mbps and Upload speed in Mbps whether it’s in a Chart or a continuosly updating div until the user closes the modal where he sees the info. So the problem is I need to request two times for data to then calculate RX/TX rates and then keep requesting and calculating tx/rx speed rates.

Right now I’m achieving what I expected at my skill level but I certainly know its not the best way, I need your help to do it rigth and as efficient as possible.

Any help would be great, thanks

This is my server response expressed in bytes, I need to request 2 times so I can calculate differences:

{
    "rx": "14986885547",
    "tx": "228270858519"
}

This is what I have:

const custId = document.getElementById('customerId')

    var bytesArr = [];
    var timeout = null;
    var traffic = (function getTraffic() {
        let url = '/customer_detail/traffic/';
        fetch(url+custId.innerText, { method: 'GET' })
        .then(Result => Result.json())
        .then(data => {
            console.log(data);
            update_data(data);
        })
        .catch(errorMsg => { console.log(errorMsg); });
        return getTraffic;
    })();
    
    function update_data(data){
        if (bytesArr.length<2){
            let arrlenght = bytesArr.push(data);
        }else{
            bytesArr.shift();
        }
        calcRates(bytesArr);
    }

    function calcRates(array){
        let startBytesIn, startBytesOut, endBytesIn, endBytesOut, txBytesPerSecond, rxBytesPerSecond = null;
        if(array.length==2){
            for (let i = 0; i < array.length; i++) {
                if(i==0){
                    startBytesIn = array[i].rx;
                    startBytesOut = array[i].tx;
                }else if(i==1){
                    endBytesIn = array[i].rx;
                    endBytesOut = array[i].tx;
                }
            }
            txBytesPerSecond = (endBytesOut-startBytesOut)
            rxBytesPerSecond = (endBytesIn-startBytesIn)
            console.log('Down Speed Mbps ',(txBytesPerSecond/125000).toFixed(2));
            console.log('Up Speed Mbps ',(rxBytesPerSecond/125000).toFixed(2));
        }else{
            txBytesPerSecond = txBytesPerSecond;
            rxBytesPerSecond = rxBytesPerSecond;
        }    
        timeout = setTimeout(traffic, 1000);
    }

and right now I’m clearing the timeout when clicking a button.

Which INPUT DATE field is being changed

When using an HTML or tag, how is it possible in JavaScript or jQuery to know which field is being changed?

What I’m trying to do specifically is change the behavior of the tag when SHIFT or ALT are pressed. I’m actually using a tag with step=.001 to change milliseconds, but I would like for SHIFT to use a step=.01 and ALT to use a step=.1 or something along those lines, so this way I wouldn’t have to wait a while to reach the value I want to be reached.

The thing is, when I am changing, e.g., the seconds or the day with the keyboard’s arrow keys, I do not want step=.1 or step=.01; I want the day or seconds to change, not the milliseconds. I can’t get this to work.

(I know that the tag isn’t supported, but this HTML page is for my own personal use, not for production.)

(I have no clue how I could do that.)