How can I add an anime.js animation to Scrollmagic?

How can I add an anime.js animation to ScrollMagic so I can play animations as I scroll. or for example if I only scroll 50% of the way, the animation stops at 50%, or if I scroll back up, the animation reverses.

I’ve tried searching online and looking through the documentation, but I can’t find anything about using these two together.

JW Player Error with DRM Keys Fetching and MPD Playback

I am encountering an issue while trying to set up JW Player with DRM protection and DASH streaming. The setup involves fetching DRM keys from a remote server and using those keys to play a DASH stream. Here’s the setup I have:

<script src="https://content.jwplatform.com/libraries/KB5zFt7A.js"></script>
<div id="player"></div>
<script>
    function fetchDRMKeys(callback) {
        const xhr = new XMLHttpRequest();
        xhr.open('GET', 'https://yuvraj43.xyz/tp-keys/live/key.php?id=516', true);
        xhr.onload = function() {
            if (xhr.status >= 200 && xhr.status < 300) {
                try {
                    const response = JSON.parse(xhr.responseText);
                    if (Array.isArray(response.keys)) {
                        callback(null, response.keys);
                    } else {
                        callback('Error parsing response');
                    }
                } catch (e) {
                    callback('Error parsing response');
                }
            } else {
                callback('Error fetching keys');
            }
        };
        xhr.onerror = function() {
            callback('Network error');
        };
        xhr.send();
    }

    fetchDRMKeys(function(error, keys) {
        if (error) {
            console.error('Failed to fetch DRM keys:', error);
            return;
        }

        const drmConfig = { clearkey: {} };
        keys.forEach(key => {
            if (key.kty === 'oct') {
                drmConfig.clearkey[key.kid] = key.k;
            }
        });

        jwplayer("player").setup({
            playlist: [{
                title: "Maa",
                description: "Test",
                image: "https://mediaready.videoready.tv/tatasky-epg/image/fetch/f_auto,fl_lossy,q_auto,h_250,w_250/https://ltsk-cdn.s3.eu-west-1.amazonaws.com/jumpstart/Temp_Live/cdn/HLS/Channel/imageContent-25361-jhsvr3nc-v1/imageContent-25361-jhsvr3nc-m1.png",
                sources: [{
                    file: "https://yuvraj43.xyz/TP-worldwide/manifest.mpd?id=516",
                    type: "dash",
                    drm: {
                        clearkey: drmConfig.clearkey
                    }
                }]
            }],
            width: "100%",
            aspectratio: "16:9",
            autostart: false,
            cast: {},
            playbackRateControls: true,
            preload: "auto"
        });

        jwplayer().on('error', function(e) {
            console.error('JW Player Error:', e);
        });

        jwplayer().on('setupError', function(e) {
            console.error('JW Player Setup Error:', e);
        });
    });
</script>

Issue:

Network Errors:

1. I’m seeing errors related to DRM key fetching, and JW Player is not playing the video. Specifically, I receive a CORS error when attempting to fetch DRM keys.

2. JW Player Error Codes: The errors shown are related to the JW Player setup (Error 242600 and 342600).

Details:

The CORS issue occurs when fetching DRM keys from https://yuvraj43.xyz/tp-keys/live/key.php?id=516.

The MPD URL is https://yuvraj43.xyz/TP-worldwide/manifest.mpd?id=516.

I have verified that the keys.php works correctly in other players(ex. NS Player)

Questions:

How can I resolve the CORS issue for the DRM keys?

What could be causing the JW Player errors, and how can I fix them?

Any help or guidance would be greatly appreciated!

Isomorphic ESM package containing browser-specific, server-specific and shared code

I am trying to create an ESM package which contains browser-specific, server-specific and shared isomorphic javascript, such as:

src/
  browser.js
  server.js
  shared.js

I have a package.json using conditional exports:

"type": "module",
"exports": {
  "node": "./src/server.js",
  "default": "./src/browser.js"
}

In a separate project I can then import the package. Such as this example-browser.js JavaScript file:

import { shared, browser } from "esm-package-browser-server";
console.log(shared('Example'));
console.log(browser('Example'));

And html file:

<html>
  <script type="importmap">
    {
      "imports": {
        "esm-package-browser-server": "./node_modules/esm-package-browser-server/src/browser.js"
      }
    }
  </script>
  <script type="module" src="example-browser.js"></script>
</html>

Server example-server.js JavaScript file:

import { shared, server } from "esm-package-browser-server";
console.log(shared('Example'));
console.log(server('Example'));

And run command:

node example-server.js

This appears to work in both environments. Questions I have:

  1. Is this a “correct” way to create an isomorphic ESM package? If not, what should I change?
  2. I had to use importmap linking to ./node_modules/esm-package-browser-server/src/browser.js is there a way to link to ./node_modules/esm-package-browser-server and infer browser.js from the exports? or better still no importmap at all?

Full source code is here:
https://github.com/kmturley/esm-package-browser-server

Slider not running to the end; only runs first two slides

I’m trying to implement a slider on my landing page. I followed this tutorial on Youtube but only the first two slides work. i slightly modified and only kept three slides. Can anybody give a second glance to my code to see if there is anything I missed? I will really appreciate it.

let items = document.querySelectorAll('.slider .list .item'); //Slider items
//console.log(items.length);

let next = document.getElementById('next');
let prev = document.getElementById('prev');
let thumbnails = document.querySelectorAll('.thumbnail .item'); //Thumbnai items
//console.log(thumbnails.length);

// Config parameter
let countItem = items.length; //The number of items into the series
let itemActive = 0; //The class '.active' counter


//Next Button click event
next.onclick = function() {
  itemActive += 1;

  if (itemActive >= countItem) {
    itemActive = 0;
  }
  showSlider(); //Run this function to display the slider ont he scrren
}

// Click on thumbnail event
thumbnails.forEach((thumbnail, index) => {
  thumbnail.addEventListener('click', () => {
    itemActive = index;
    showSlider();
  });
});

//Run the slider automatically without any click
let refreshInterval = setInterval(() => {
  // Execute the next button click automatically every 3s. 
  next.click();
}, 3000);

function showSlider() {
  // Remove item active old
  let itemActiveOld = document.querySelector('.slider .list .item.active');
  let thumbnailActiveOld = document.querySelector('.thumbnail .item.active');

  itemActiveOld.classList.remove('active');
  thumbnailActiveOld.classList.remove('active');

  // Set class '.active' to new item
  items[itemActive].classList.add('active');
  thumbnails[itemActive].classList.add('active');

  // Clear automatic slider run
  clearInterval(refreshInterval);
}
<!-- SLIDER -->
<div class="slider">
  <!-- List of items -->
  <div class="list">
    <div class="item active">
      <img src="assets/images/student-1.jpg" alt="">
      <div class="content">
        <p>Prospective and Returning Students</p>
        <h2>Plan your success now!</h2>
        <p>Find and apply to the best Higher Education institutions in the Democratic Republic of the Congo.</p>
        <a href="schools.html" class="btn">Track Your Application</a>
      </div>
    </div>
    <div class="item">
      <img src="assets/images/student-2.jpg" alt="">
      <div class="content">
        <p>Colleges & Universities</p>
        <h2>Join Our Community</h2>
        <p>
          Register your school to boost your admissions rate. Your prospective students can apply from anywhere in the world.
        </p>
        <a href="schools.html" class="btn">Visit Our Schools' Directory</a>
      </div>
    </div>
    <div class="item">
      <img src="assets/images/student-5.jpg" alt="">
      <div class="content">
        <p>Education Advisors</p>
        <h2>Meet Our Dedicated Advisors</h2>
        <p>Our team is made of professional education advisors, ready to assist and set you into your pathway to success.</p>
        <a href="advisors.html" class="btn">Schedule a meeting</a>
      </div>
    </div>
  </div>
  <!-- Arrow buttons -->
  <div class="arrows">
    <button id="prev"><</button>
    <button id="next">></button>
  </div>
  <!-- Thumbnail -->
  <div class="thumbnail">
    <div class="item active">
      <img src="assets/images/student-1.jpg" alt="">
      <div class="content">Students</div>
    </div>
    <div class="item">
      <img src="assets/images/student-2.jpg" alt="">
      <div class="content">Schools</div>
    </div>
    <div class="item">
      <img src="assets/images/student-5.jpg" alt="">
      <div class="content">Advisors</div>
    </div>
  </div>

</div>
<!-- SLIDER -->

The sliders are run using javascript. I’ve double-checked to see if there is any mistake but could not find where the issue could be.

Converting Classic ASP to Javascript to display HTML pages

We are updating our server and it will no longer support Classic ASP. The site is simple, I just don’t know how to do it.

All in same folder: index.html, a.html, b.html

a.html:

<p>this is A</p>

b.html:

<table>
  <tr>
    <td><a href="test1.html"><img src="images/test1.png"><br>Test 1</a></td>
    <td><a href="test2.html"><img src="images/test2.png"><br>Test 2</a></td>
    <td><a href="test3.html"><img src="images/test3.png"><br>Test 3</a></td>
  </tr>
</table>

URL:

index.html?file=a
    

index.html:

<p>
  Menu
  <br>
  <a href="index.html?file=a"Show A</a>
  - 
  <a href="index.html?file=b"Show B</a>
</p>

This part is what I need to figure out:

FileValue = GetFromURL(file)
Select FileValue
  a then show a.html
  b then show b.html
  else
    "you need to select an item from the menu"
end select

I have done no coding since the original development almost 12 years ago.

why does my modal not close when I click outside the modal? [duplicate]

I have a webpage with an image. When I click on the image, it opens modal. When I click on the close button, it closes the modal. However, when I click outside the modal, it doesn’t close the modal. I added event listener to detect clicks but doesn’t work. I am out of ideas. Here is my code. Thanks.

document.addEventListener("DOMContentLoaded", function() {
  var modal       = document.getElementById("imageModal");
  var modalImg    = document.getElementById("modalImage");
  var captionText = document.getElementById("caption");

  // Select only images with the 'modal-trigger' class
  var images = document.querySelectorAll(".modal-trigger");

  images.forEach(function(img) {
    img.onclick = function() {
      modal.style.display = "block";
      var modalSrc = this.getAttribute("data-modal-src") || this.src;
      modalImg.src = modalSrc;
      captionText.innerHTML = this.alt;
    }
  });

  var span = document.getElementsByClassName("close")[0];

  // Check if the close button exists
  if (span) {
    span.onclick = function() {
      modal.style.display = "none";
    }
  } else {
    console.error("Close button not found.");
  }

  // Close the modal if the user clicks anywhere outside the modal content
  window.addEventListener("click", function(event) {
    // Check if the click is outside the modal content
    if (event.target === modal) {
      modal.style.display = "none";
    }
  });
});
/* The Modal (background) */
.modal {
  display: none;       /* Hidden by default */
  position: fixed;     /* Stay in place */
  z-index: 1;          /* Sit on top */
  padding-top: 20px;   /* Location of the box */
  left: 0;
  top: 0;
  width: 100%;      /* Full width */
  height: 100%;     /* Full height */
  overflow: auto;   /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.6);
}

/* Modal Content (image) */
.modal-content {
  margin: auto;
  display: block;
  width: 60%;
}

/* Caption of Modal Image (Image Text) - Add some padding */
#caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
}

/* Add Animation - Zoom in the Modal */
.modal-content,
#caption {
  animation-name: zoom;
  animation-duration: 0.6s;
}

@keyframes zoom {
  from { transform: scale(0) }
   to  { transform: scale(1) }
}

/* The Close Button */
.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}

.close:hover,
.close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

.timeline-item img {
  display: block;
  transition: opacity 0.3s ease, transform 0.3s ease;
  cursor: pointer; /* Show a pointer cursor on hover */
}

.timeline-item img:hover {
  opacity: 0.7;
  transform: scale(1.05); /* Slightly enlarge the image on hover */
}
<div class="timeline-item" style=" left: 120px;">
  <img alt="" class="modal-trigger" 
       src="https://compote.slate.com/images/22ce4663-4205-4345-8489-bc914da1f272.jpeg?crop=1560%2C1040%2Cx0%2Cy0&width=1280" 
       style=" position: relative; top: 70px; width: 215px; left: -30px;" 
  />
</div>

<div id="imageModal" class="modal">
  <em>
    <span class="close">×</span> 
    <img alt="" class="modal-content" id="modalImage" />
  </em>
  <div id="caption"></div>
</div>

</div>

RustDesk & Flutter web build errors | .dart files causing errors when attempting a web build

I’m having a lot of issues with the “flutter build web –release” command. This is for making a web build so that I may utilize the RustDesk web client services. I’ve been having a lot of issues with .dart files not being properly read in JS format. Here are the following errors when attempting to start the web build:

ptech@rustdeskdev:~/FOO/rustdesk/flutter$ flutter build web --release

Warning: In index.html:97: Local variable for "serviceWorkerVersion" is deprecated. Use "{{flutter_service_worker_version}}" template token instead. See
https://docs.flutter.dev/platform-integration/web/initialization for more details.
Target dart2js failed: ProcessException: Process exited abnormally with exit code 1:
../../../.pub-cache/hosted/pub.dev/firebase_core-3.4.0/lib/src/firebase_app.dart:18:25:
Error: Member not found: 'FirebaseAppPlatform.verify'.
    FirebaseAppPlatform.verify(_delegate);
                        ^^^^^^
lib/pages/scan_page.dart:54:58:
Error: Member not found: 'abgr'.
                            .getBytes(format: img.Format.abgr)
                                                         ^^^^
lib/pages/scan_page.dart:48:41:
Error: The argument type 'Uint8List' can't be assigned to the parameter type 'String'.
 - 'Uint8List' is from 'dart:typed_data'.
                        File(file.path).readAsBytesSync(), file.path)!;
                                        ^
lib/pages/scan_page.dart:48:65:
Error: The argument type 'String' can't be assigned to the parameter type 'Uint8List'.
 - 'Uint8List' is from 'dart:typed_data'.
                        File(file.path).readAsBytesSync(), file.path)!;
                                                                ^
lib/pages/scan_page.dart:54:39:
Error: No named parameter with the name 'format'.
                            .getBytes(format: img.Format.abgr)
                                      ^^^^^^
../../../.pub-cache/hosted/pub.dev/dash_chat-1.1.16/lib/src/message_listview.dart:247:72:
Error: The argument type 'String?' can't be assigned to the parameter type 'String' because 'String?' is nullable and 'String' isn't.
                                                                      .text));
                                                                       ^
../../../.pub-cache/hosted/pub.dev/dash_chat-1.1.16/lib/src/widgets/message_container.dart:107:43:
Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
 - 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../../rustdesk/flutter/flutter/packages/flutter/lib/src/material/theme_data.dart').
                      ? Theme.of(context).accentColor
                                          ^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/dash_chat-1.1.16/lib/src/widgets/quick_reply.dart:43:60:
Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
 - 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../../rustdesk/flutter/flutter/packages/flutter/lib/src/material/theme_data.dart').
                      width: 1.0, color: Theme.of(context).accentColor),
                                                           ^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/dash_chat-1.1.16/lib/src/widgets/quick_reply.dart:51:46:
Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
 - 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../../rustdesk/flutter/flutter/packages/flutter/lib/src/material/theme_data.dart').
                    color: Theme.of(context).accentColor,
                                             ^^^^^^^^^^^
Error: Compilation failed.
  Command: /home/ptech/rustdesk/flutter/flutter/bin/cache/dart-sdk/bin/dart /home/ptech/rustdesk/flutter/flutter/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot
  --platform-binaries=/home/ptech/rustdesk/flutter/flutter/bin/cache/flutter_web_sdk/kernel --invoker=flutter_tool -Ddart.vm.product=true -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=true
  -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/9c3f66d822e499ee2109dd08b099554bdf2bc93f/ --native-null-assertions --no-source-maps -o
  /home/ptech/FOO/rustdesk/flutter/.dart_tool/flutter_build/5fe9e7ee08d54441cabe9828f988da50/app.dill --packages=/home/ptech/FOO/rustdesk/flutter/.dart_tool/package_config.json --cfe-only
  /home/ptech/FOO/rustdesk/flutter/.dart_tool/flutter_build/5fe9e7ee08d54441cabe9828f988da50/main.dart
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:122:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:389:19)
<asynchronous suspension>
#2      Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:202:5)
<asynchronous suspension>
#3      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:891:9)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:520:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:829:32)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:520:21)
<asynchronous suspension>
#7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:829:32)
<asynchronous suspension>
#8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:651:16)
<asynchronous suspension>
#9      WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:92:34)
<asynchronous suspension>
#10     BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:230:5)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1450:27)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#13     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:421:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5)
<asynchronous suspension>
#17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
<asynchronous suspension>
#18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#19     main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>

Compiling lib/main.dart for the Web...                             13.5s
Error: Failed to compile application for the Web.

For added context, I am attempting to follow along with these following steps on how to get this build working correctly:

git clone https://github.com/JelleBuning/rustdesk.git
cd rustdesk
git switch fix_build
cd flutter/web/js

# Install protoc first, see: https://google.github.io/proto-lens/installing-protoc.html
npm install ts-proto
# Only works with vite <= 2.8, see: https://github.com/vitejs/vite/blob/main/docs/guide/build.md#chunking-strategy
npm install [email protected]

# Required for yarn build
npm install yarn -g
npm install typescript -g
npm install protoc -g

yarn build

cd ..

# About details of YUV converter, check this https://github.com/rustdesk/rustdesk/issues/364#issuecomment-1023562050
wget https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/web_deps.tar.gz
# Decompress to the current directory
tar xzf web_deps.tar.gz

cd ..

flutter build web --release
cd build/web
# You could use any server, just an example
python -m http.server 8000

I am currently on the “flutter build web –release” step where I begin to run into my issues with getting this completed.

I have dart2js which is supposed to be helping compile the JS within the .dart files to be in a readable state, though when I compile the .dart files, I get an incredibly long list of errors for each and every .dart file present on the dev server even when specifying it to only compile one file in a given directory. Example:
ptech@rustdeskdev:~/FOO/rustdesk/flutter$ dart compile js ~/FOO/rustdesk/flutter/lib/pages/scan_page.dart

I just need a little bit of assistance with understanding what it is I’m doing wrong when it comes to these .dart files and why they seem to keep failing.

Learning about javascript, struggling with basic and so on [closed]

so here is a thing , i got into js and i’v been learning like over a 3 week now, it is always like i know exact logic behind the project but i struggle to translate it in code. basically i take note before writing code , ( i work on small projects ) and i detail it as much as i can , but i always get an error , even tho i write . it is not always that i don’t write , i try to write as much as i can even tho it might make 0 sense and get error everytime , i need kind of advice i think.

it is my first time on this site

Return on Puppeteer’s event listener

I have a simple issue which I am not able to solve for last couple of days… I need to pack page on response inside a separate function called setupRequestInterception. When I do that the code is not working, I get a timeout.

import puppeteer from 'puppeteer';

const setupRequestInterception = async (page) => {
    await page.setRequestInterception(true);

    return new Promise((resolve, reject) => {
        page.on('request', (request) => {
            request.continue();
        });

        page.on('response', async (response) => {
            const headers = response.headers();

            resolve(headers); // Resolve the promise with the headers
        });

        page.on('close', () => {
            reject(new Error('Page closed before headers could be intercepted.'));
        });

        setTimeout(() => {
            reject(new Error('Timeout reached before headers could be intercepted.'));
        }, 10000); // Set a timeout to prevent hanging
    });
};

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();

    try {
        const headers = await setupRequestInterception(page);
        await page.goto('https://google.com');
        console.log('Intercepted Headers:', headers);
    } catch (err) {
        console.log('Error:', err.message);
    } finally {
        await browser.close();
    }
})();

But when I do that like this, it works.

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();

    try {
        const headers = new Promise((resolve, reject) => {
            page.on('response', async (response) => {
                const headers = response.headers();
    
                resolve(headers); // Resolve the promise with the headers
            });
    
            page.on('close', () => {
                reject(new Error('Page closed before headers could be intercepted.'));
            });
    
            setTimeout(() => {
                reject(new Error('Timeout reached before headers could be intercepted.'));
            }, 10000); // Set a timeout to prevent hanging
        });

        await page.goto('https://google.com');
        console.log('Intercepted Headers:', headers);
    } catch (err) {
        console.log('Error:', err.message);
    } finally {
        await browser.close();
    }
})();

How to retrieve a WooCommerce product price with Javascript?

We have a plugin that runs that updates the price of products in the Woo system. It does this every two minutes.

The price display update will be done with jQuery using setInterval.

Trying to find documentation on how to use Javascript to retrieve the current price.

Right now I’m getting it working on a product page but eventually it’ll have to work on Shop/Cart/Checkout as well (a can of worms I know).

Search has netted no leads. Any help is appreciated.

How to open folder in explorer onclick of button in Electron?

How do I open a folder in explorer onclick of a button in my electronjs application? I got it to work by making it where it is executed at program start in the main. But id i make it a function and call in it with onclick from HTML button it doesn’t work. Ive tried form renderer, main, and preload. I’m pretty knew to electron and node, so i have a feeling that maybe I’m not understanding the processes correctly?

default.html

<button name="SystemMenu-Button" id="SystemMenu-Button" class="SystemMenu-Button" onclick="openDocuments()">
    Documents
    <i name="SystemMenu-ButtonIcon" id="SystemMenu-ButtonIcon" class="fa-solid fa-folder-open fa-fw"></i>
</button>

default.main.js – works but not what I need

const { app, BrowserWindow, shell } = require('electron');
const path = require('node:path');
const documentsPath = 'E:/';

shell.openPath(documentsPath);

default.main.js – wont work but it need it to

const { app, BrowserWindow, shell } = require('electron');
const path = require('node:path');
const documentsPath = 'E:/';

function openDocuments() {
    shell.openPath(documentsPath);
}

WhatsApp API redirection issue on iPhone using Instagram’s browser with https://wa.me link

I’m encountering a problem with automatic redirection to WhatsApp using the https://wa.me link in an eCommerce setup, which specifically affects iPhone users when accessed via the Instagram browser.

Our eCommerce platform allows customers to finalize their orders via WhatsApp. Users click on the “Place Order on WhatsApp” button, intended to redirect them directly to a WhatsApp chat with pre-filled order details. This is achieved through a link formatted as https://wa.me/?text=urlencodedtext.

On iPhones, specifically when accessed through the Instagram browser, the automatic redirection to WhatsApp does not occur. Instead of opening WhatsApp directly, users are directed to a WhatsApp screen. Upon clicking the “Go to Chat” button, they are informed that WhatsApp is not installed, despite it being already installed on the device.

Code Example:

<a href="https://wa.me/1234567890?text=I%20want%20to%20place%20an%20order">Place Order on WhatsApp</a>

I need the link to seamlessly open the WhatsApp app with the pre-filled message on iPhones, especially when accessed through the Instagram browser. The current behavior appears to be a miscommunication between the browser and the app on iOS devices.

Has anyone experienced a similar issue or knows a workaround for this specific scenario on iPhones using Instagram’s browser?