bookmarklet

javascript prompt for password (i.e. *******)

Deadly 提交于 2019-12-01 08:40:17
I'm writing a bookmarklet and I need to be able to prompt the user for a "password". However, I don't want it to be in clear text on screen, so I cannot use prompt. Is there a masked alternative to prompt()? Any other suggestion? You can create a floating div on the current page, with a form containing a password field. alternative: let the bookmarlet point to a particular web page. Get the password from the user on that page, and continue. This solution does not use javascript at all, as you may have noticed. If you really insist on using javascript, you will have to create a new window using

javascript prompt for password (i.e. *******)

ⅰ亾dé卋堺 提交于 2019-12-01 06:05:20
问题 I'm writing a bookmarklet and I need to be able to prompt the user for a "password". However, I don't want it to be in clear text on screen, so I cannot use prompt. Is there a masked alternative to prompt()? Any other suggestion? 回答1: You can create a floating div on the current page, with a form containing a password field. 回答2: alternative: let the bookmarlet point to a particular web page. Get the password from the user on that page, and continue. This solution does not use javascript at

Getting the current domain name in Chrome when the page fails to load

你。 提交于 2019-12-01 05:37:09
问题 If you try to load with Chrome: http://sdqdsqdqsdsqdsqd.com/ You'll obtain: ERR_NAME_NOT_RESOLVED I would like, with a bookmarklet, to be able to get the current domain name and redirect it to a whois page in order to check if the domain is available. I tried in the console: window.location.href but it outputs: "data:text/html,chromewebdata" Is there any way to retrieve the failed URL? 回答1: The solutions given by others didn't work (maybe because I was getting a different error or have a

js: Load html of a page from a different domain

天涯浪子 提交于 2019-12-01 01:08:36
I was wondering how can I load HTML, which is hosted on a different domain? I am using JavaScript, and want to create a bookmarklet that will enable me to parse the external HTML. I have been googling for hours in vain... JavaScript isn't allowed to make cross-domain requests. It's a big security risk. Instead, you'll have to execute a script on the server and have it return the results to your JavaScript function. For example, assuming that you're using JavaScript and PHP you could setup the application to work like this: JavaScript initiates an Ajax request to a page (or script) located on

How to inject script into a page using bookmarklet if the Content Security Policy is enabled on the server?

不羁的心 提交于 2019-11-30 23:32:30
I have a bookmarklet which uses jQuery and parses some elements on the page. To use jQuery, i am creating a script tag(with src as the jQuery URL) dynamically and appending to the head tag. This works well for many sites. But, there are few sites like Facebook, for which the bookmarklet is not able to inject the external JS file into the dom.I came to know that this behaviour is because of the response header "Content Security Policy" which prohibits the inclusion of scripts from any other unauthorized domain. This is to prohibit XSS atacks. I have a genuine case to insert an external JS file

js: Load html of a page from a different domain

孤街浪徒 提交于 2019-11-30 20:46:36
问题 I was wondering how can I load HTML, which is hosted on a different domain? I am using JavaScript, and want to create a bookmarklet that will enable me to parse the external HTML. I have been googling for hours in vain... 回答1: JavaScript isn't allowed to make cross-domain requests. It's a big security risk. Instead, you'll have to execute a script on the server and have it return the results to your JavaScript function. For example, assuming that you're using JavaScript and PHP you could

Bookmarklet Help: Creating a Find/Replace Bookmarklet

限于喜欢 提交于 2019-11-30 19:17:37
问题 I'm trying to slightly modify this so that it prompts for the text to search for, followed by the text to replace with, and when all done processing, show a dialog box letting me know it's done. I plan to use it on a phpmyadmin database edit page that'll have any number of textboxes filled with text ( which is what I need it to search and replace in ). Also, the text to search for and replace may or may not be multi-line, so I've added the 'm' param in the regex, and also, since I'll be doing

Javascript get selected text from any textinput/textarea on the page

血红的双手。 提交于 2019-11-30 14:32:45
How can get the selected text from a textbox/textarea if I don't know which one active (focused). I am trying to create a small bookmarklet that will correct the selected text in any type of input on a page. pimvdb For the selection, you want selectionStart and selectionEnd . As for the currently focused element, use document.activeElement . So as a combination you can use: http://jsfiddle.net/rBPte/1/ . As Tim Down pointed out, you'd need a more complex solution for Internet Explorer version 8 or lower: Caret position in textarea, in characters from the start function getText(elem) { // only

highlight a DOM element on mouse over, like inspect does

不羁的心 提交于 2019-11-30 12:16:03
问题 We have a bookmarklet, and the user clicks a button and an inspect like highligther needs to kick in. We want to this to be cross browser. For this we need to detect the DOM element during the mouse move, and once we have this element we need to highlight with CSS. We have problems detecting the DOM element by mouse move, can you guide us how this is done? Once we have this DOM element, on user click we need to extract XPath. 回答1: You can hook mousemove on document or document.body , then use

Gmail conversation view toggle bookmarketlet / favelet / “scriptlet”

大兔子大兔子 提交于 2019-11-30 11:18:01
I noticed that if I have a gmail tab open with conversation view on/off, and then I open another tab and change the conversation view setting, my original tab stays in the conversation view state it started in such as when doing new searches etc. and the new tab uses the setting I just changed it to. This led me to think there might be some JavaScript bookmarklet / favelet / "scriptlet" that could easily let us change the setting for a given gmail tab temporarily without having to go into the settings. Does anyone know of this already in existence or is anyone able to create it? My thought