The context menu event fails to activate on browsers running iOS 13.1 and higher when attempting to select text

After updating the iOS version to 13.1, we encountered an issue where the long-press context menu event is not triggering in the browser. Instead, the default browser context menu is being displayed. Our goal is to hide these context menus.

!DOCTYPE html>
<html>
<head>
<style>
div {
  background: yellow;
  border: 1px solid black;
  padding: 10px;
}
</style>
</head>
<body>



<div id="myDIV">
<p>Right-click inside this box to see the context menu!


</div>



<script>
document.getElementById("myDIV").addEventListener("contextmenu", myFunction);

function myFunction() {
 alert('context menu fired');

}
</script>


</body>
</html>

Answer №1

It has come to my attention that Safari on iOS is currently missing support for the context menu event, as outlined here.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The ajax function does not provide a response

Can you help me figure out why this JavaScript function keeps returning 'undefined'? I really need it to return either true or false. I've included my code below: function Ajax() { var XML; if(window.XMLHttpRequest) XML=new ...

Issues with iOS application crashing immediately after being launched when using the archived app built file from Xcode9.2

While working on my Ionic app in Xcode, I ran the following command successfully: ionic ios build The build was completed using Xcode 9.2 and I even managed to run the archive. However, when launching the app from the archive file to iPhone, it opened bu ...

Introducing unnecessary DOM elements when displaying flash messages

When a user saves in my Rails application, it triggers an Ajax request to save the post and then runs the update.js.erb file. This file contains some jQuery code: $('body').append('<div class="message">Saved</div>'); Due t ...

What is the best way to display a JavaScript object array on the screen

As someone who is new to JavaScript, I have a JavaScript object array that I would like to print the values of in the browser. However, I am unsure of how to do this without using document.write(vehicle); var vehicle = [{name:'Van',wheel:4,cha ...

Anticipated an array but received something else (JSON) - AngularJS Error

Currently, I am immersing myself in Angular1 with the help of Adam Freeman's "Pro AngularJS" book. However, I have encountered a hurdle while trying to build a DeployD app as outlined in chapters 6-8. It appears that my code is having trouble reading ...

Repeating every other item in a list using ng-repeat in AngularJS

Using AngularJS version 1.5.3 In my view, I have a list of items that I want to display. After every two items, I would like to show a new div below the first one. <div class="col text-center" ng-repeat="event in weekDay.events"> &nbsp;& ...

React - Uncaught Error: e.preventDefault is not a function due to Type Error

Encountering an issue with Axios post and react-hook-form: Unhandled Rejection (TypeError): e.preventDefault is not a function The error arises after adding onSubmit={handleSubmit(handleSubmitAxios)} to my <form>. Seeking to utilize react-hook-form ...

What steps should I follow to integrate ng-file-upload with Node.js?

Currently, I am working on a project that involves Angular, Node, Express, Multer, and ng-file-upload. Unfortunately, I have encountered a 400 (bad request) HTTP error while testing my code. Despite trying various solutions, the issue persists. Below is a ...

What is the best way to wait for a button's listeners to resolve in JavaScript?

Currently, I am conducting frontend tests utilizing Jest with the jsdom environment to simulate a DOM tree and manually trigger actions such as button.click(). My goal is to be able to await button.click(), which in my expectations should wait for all of ...

Eliminate the excess padding from the Material UI textbox

I've been struggling to eliminate the padding from a textbox, but I'm facing an issue with Material UI. Even after setting padding to 0 for all classes, the padding persists. Could someone provide guidance on how to successfully remove this pad ...

Achieving the correct order when sorting an NSArray of alphanumeric strings in Objective-C

I am facing a sorting issue with an array of strings that contain numbers like Shift 1 RT9909. The current sorting method I use is: NSSet *forms = dataObject.rtForms; NSSortDescriptor *nameDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"type" asce ...

Getting data from a URL using Node.js and Express: A beginner's guide

Currently, I am facing an issue with extracting the token value from the URL http://localhost:3000/users/reset/e3b40d3e3550b35bc916a361d8487aefa30147c8. My get request successfully validates the token and redirects the user to a password reset screen. Howe ...

Combining objects within an array based on shared key values

Is there a way to merge objects with the same date into one cohesive data set? I could use some guidance. const info = [ { date: '1 Day', green: 35 }, { date: '2 Day', green: 64 }, { date ...

Navigating through items and organizing based on several criteria

In JavaScript, I am currently learning about accessing objects and sorting them based on multiple conditions. As a beginner in JavaScript, this may seem like a very basic question to some. My task involves sorting based on the 'status' field. va ...

Drop and drag to complete the missing pieces

Here is a drag and drop fill in the blanks code I created. The challenge I'm facing is that I want users to be able to correct their mistakes by moving words to the right place after receiving points. <!DOCTYPE HTML> <html> <head&g ...

Switch out "FOR" in order to sum up every value within an array

Utilizing Javascript, I have an array defined as follows: counts: [ { id: 1, value: 0 }, { id: 2, value: 10 }, { id: 3, value: 5 }, { id: 4, value: 3 } ] I aim to calculate a variable named total that holds the sum of all valu ...

personalized options for initiating and concluding html audio component

I am currently facing an issue with my html audio element that plays a track. The setup is quite straightforward: <audio controls loop="loop"> <source type="audio/wav" src="song.wav"> </audio> However, I need to create custom start ...

How can we modify specific values of an object using Lodash and return the updated object?

const fruits = { apple: 2, orange: 3, grape: 4, banana: 5 } My aim is to adjust the values of certain fruits while being able to reference their current values. For example: const premiumFrutis = _.doSomething(fruits, apple + 2, banana + ...

iPhone Development: How to Achieve a Rolling Effect using Objective-C

I have a function designed to move a UIView across the screen: -(void)animateView:(UIView *)p_view { CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.x"]; animation.delegate = self; animation.fromValue = [NSNum ...

I aim to customize the options of a dropdown list based on the selection of another dropdown

I am looking for a way to dynamically filter employees based on the department selected. Unfortunately, my knowledge of JavaScript and Ajax is limited. <div class="pure-checkbox ml-15"> <input id="checkbox2" name="sta ...