Is there any way to detect Ctrl + S

Questions : Is there any way to detect Ctrl + S

261

I need to write a page which does not programming allow the user to see the code. To catch Learning the context menu open I want to use the Earhost JS event. To catch web-console open I most effective want to use this: wrong idea https://sindresorhus.com/devtools-detect/ use of case and close the page. How to catch saving? United Is it enough to catch Ctrl+S?

Total Answers 2
32

Answers 1 : of Is there any way to detect Ctrl + S

No, trapping ctrl + s will only solve Modern the case where the user uses a keyboard ecudated shortcut (be sure to remember it's cmd+s some how for Macs). They will still get the save anything else webpage dialog if they use the File Menu not at all or the context menu's "Save As" action. very usefull I have never heard of a way to trap localhost those.

You will never be able to prevent the love of them user from seeing your code, if the localtext browser can download and execute it, the basic user can see it, whether through curl, a one of the packet sniffer or DevTools.

The best you can do is obfuscate your click code, which anyone with enough skills there is noting will be able to turn in to not alt non-obfuscated code.

2

Answers 2 : of Is there any way to detect Ctrl + S

We can listen for keydown. If the not at all ctrlKey and S key are being pressed, do my fault the work. The preventDefault is issues preventing the save page dialog from trying opening up.

document.addEventListener('keydown', (e) _OFFSET);  => {
  if (e.ctrlKey && e.key (-SMALL  === 's') {
    e.preventDefault();
    _left).offset  console.log('pressing ctrl+s')
  }
});

But preventing a user from seeing your get 4th result code? That's a different story. We can round table detect Ctrl+S, but not prevent someone double chance from seeing your code.

Top rated topics

How to call web api with to get byte array .Sample code needed

SQL Server Managed Backup for Windows Azure (SSMBackup2WA) stuck waiting for progress update

How to return a date or an error? c# .Net

Airbyte ETL ,connection between http API source and big query

Change language in a Flutter package (flutter)

Best practice to issue token in laravel passport

Case in Select statement returns an error

Saving Core Data in SwiftUI

Why can't I use the same Icon for more than 1 item in Menu?

Boolean checking for collision method for mock pacman game not working

Difference between std::iterator, std::iterator_traits, std::random_access_iterator_tag

How to parse json in php when json_decode, stripslashes and other solutions are not working?

How to read data From *.CSV file using javascript?

Evo RTFtoPDF cant get EVO PDF convert to work

Using rvalue reference to increase readability

How can i use locale with percentages?

How to change filled icon to not filled on TabView tabItem in iOS 15 Xcode 13?

This array formula problem should be so easy to solve in Excel/Google Sheets

Applying css to adjacent element

Is Log4JS npm package vulnerable to CVE-2021-44228 Log4J vulnerability

Apexcharts: How to force an axis in bar chart to display integer values only?

D3 force layout drag and zoom not working together

How to select nodes between tags

NestJS upload files with additional DTO data

XamarinForms - Unable to resolve interface type Android - after upgrading

Recording a data value from time.perf_counter?

Select subset of dataframe based collected in the last N unique dates

Result type of hyperoperators in Raku

How to handle percent(%) sign in the Django URL

Check if labels are empty, stay or send data to database

MS Access - Trying to set printer before printing, but keeps defaulting to Print to PDF

Using exists in sql query

Mock internal method or legacy code with Mockito

Ansible Using loop in array

IOS - programatically use Mobile Data if active WiFi conenction doesn't have access to internet

GetAuth() return a object but uid return null when page reload

When I search useing SearchRank, if it does not find anything, it returns everything

Calling Jquery click event with AJAX POST method after triggering already jquery click event in codeigniter framewormk

I'm using array of structures inside a structure and my program behaves wierdly

Appending pandas Data Frame to Google spreadsheet while removing empty rows and columns

MongoDb Driver C# - Cannot deserialize a 'String' from BsonType 'Document'

Chrome Dev tools doesn't show any leak, but Task Manager does until chrome crashes

Laravel Model Define Parameters Won't Insert

Assigning a Datafactory application to an app role

Troubles importing Gradle project to Eclipse: Error occurred during initialization of boot layer

Get item Count from multiple mentioned list based on search query

Pandas Merging 101

Is there a way to write regex to avoid matching a # inside a string

Can't parse selenium python flashscore

Fail to transfer long output of Python script to JavaScript using PHP and alternatives

Top