问题描述
有什么方法可以在JavaScript或jQuery的帮助下操作Chrome设置?我想使用JavaScript禁用保存密码弹出式气泡。如何做到这一点?
现在我将就自己的问题给出答案。
它既可以在Chrome浏览器中使用,也可以在Mozilla Firefox中完成。
适用于Chrome
首先,您必须移除输入类型的密码属性。
背后的主要原因是您将输入类型=文本和输入类型=密码主要浏览器显示弹出。由于浏览器具有内置功能,可以在输入input =password时显示弹出窗口。
现在我们可以从中操作chrome了。
下面是一个例子
< html>
< head>
< title>删除保存密码弹出Chrome浏览器< / title>
< style>
#txtPassword {
-webkit-text-security:disc;
}
< / style>
< / head>
< body>
< input type =textid =txtUserName/>
< br />
< input type =textid =txtPassword/>
< br />
< / body>
< / html>
这是用于将文本转换为项目符号的css属性。
对于Mozilla
您无法在Mozilla中执行此操作。因为-moz-text-security已过时。它不在mozilla中工作。
但是我们也可以操作mozilla。
现在有了字符列表在所有主流浏览器都支持的html代码中。
从该字符的子代码是'&#8226;'。当你用html编写这段代码时,它会打印出这样的符号
现在我们可以用这些符号替换文本字段 p>
但是这有一个限制。您不能在文本框内打印项目符号。但也有解决这个限制的方法。因为在编程世界中一切都是可能的。
为此限制,我们可以在编写密码时使假div 显示子弹。
以下是一个示例。
< html>
< head>
< title>删除保存密码弹出Mozilla< / title>
< script src =// cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.jstype =text / javascript>
< script>
函数RemoveSavedPassword(){
if(jQuery.browser.webkit == undefined){
inputValue = $('。real-input')。val();
numChars = inputValue.length;
showText =; (i = 0; i< numChars; i ++){
showText + =&#8226;;
}
$('。fake-input')。html(showText);
}
}
< / script>
< / head>
< body>
< div class =input-box>
< label>输入密码:< / label>
< div class =fake-input>< / div>
< input type =textonKeyUp =RemoveSavedPassword()class =real-input>
< / div>
< / body>
< / html>
现在有了CSS的魔力。魔术意味着我们可以操纵用户的保证金,填充,不透明度和位置属性。
$ b
安全问题
对于输入类型=text而不是输入类型=密码,你可以访问这个链接:
Is there any way to manipulate Chrome settings with the help of JavaScript or jQuery? I want to disable the save password pop-up bubble using JavaScript. How to do this?
Now I am going to give answer on my own question.
It can be done in both chrome as well as in mozilla fire fox.
For Chrome
First of all you must have to remove the attribute "password" of input type.
The main reason behind this is when you take input type = "text" and input type = "password" major browser shows that pop up. Because browsers have inbuilt functionality to show that pop up when you take input type = "password".
Now we can manipulate chrome from this.
Here is an example
<html>
<head>
<title> Remove Save Password Pop Up For Chrome </title>
<style>
#txtPassword{
-webkit-text-security:disc;
}
</style>
</head>
<body>
<input type="text" id="txtUserName" />
<br />
<input type="text" id="txtPassword" />
<br />
</body>
</html>
It is css property that is used for changing text into bullets.
For Mozilla
You cannot do this in mozilla. Because -moz-text-security is obsolete. It is not working in mozilla.
But we can also manipulate mozilla.
Now there are list of character codes in html that is supported in all of the major browsers.
From that character code for bullet is '•'. When you write this code in html it will print bullet like this "•"
Now we can replace the text field with these bullets
But there is one limitation for this. You cannot print bullets inside the text box. But there is also solution for that limitation. Because everything is possible in programming world.
For that limitation we can make fake div that shows bullets when you write password.
Here is an example.
<html>
<head>
<title> Remove Save Password Pop Up For Mozilla </title>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript">
<script>
function RemoveSavedPassword() {
if (jQuery.browser.webkit == undefined) {
inputValue = $('.real-input').val();
numChars = inputValue.length;
showText = "";
for (i = 0; i < numChars; i++) {
showText += "•";
}
$('.fake-input').html(showText);
}
}
</script>
</head>
<body>
<div class="input-box">
<label>Enter password:</label>
<div class="fake-input"></div>
<input type="text" onKeyUp="RemoveSavedPassword()" class="real-input">
</div>
</body>
</html>
Now there is magic of CSS. Magic means power of margin, padding, opacity and position attribute we can manipulate user.
Here is the link:
http://codepen.io/jay191193/pen/bVBPVa
Security Issue
For security issue of input type="text" instead of input type="password" you can visit this link:
Security issue of changing type="password" into type="text"
这篇关于如何通过JavaScript禁用Chrome的保存密码提示设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!