I have a SCORM compliant course where only PDFs are to be shown. I want to show the user name to be populated in the PDF using JavaScript whenever user launches the PDF from LMS.
Please Suggest something.
It is quite difficult to determine the name of the user, because the system does not really know it. The closest you can use automatically would be the login name of the user.
There is a JavaScript property which represents the login name of the user. However, for privacy reasons, this property is only accessible when Acrobat/Reader starts up. In order to make it available for the document, you'd have to install an application-level script which would read out the login name and make it available in a (global) variable. This is rather impractical and only possible if you have control over your user's machine.
An alternative is a bit kludgy, but would work, is to create an annotation (for example freetext), and display the author property of the annotation. If not changed elsewhere, this would be the login name.
Another approach would be showing a app.answer() dialog where the user has to enter the name, and then you can fill that answer into the text fields where you want it to appear.
Related
I am creating a website using HTML (no visual editors at all - please do not suggest me one), and I want to add an accounts system. I have already made an example database, a signup/login form but I wonder about something. Is there a stable address that can be received and processed, and every device has one? I am asking this because I also want to make a connections table where all the devices' addresses will be located, along with the account they are linked to.
Is there a way to receive this address, and keep it even after the browser, device, and everything is closed?
If it is, please tell me. I prefer pure JavaScript, but, if there is only a way to do it in jQuery, then, I'll have to learn jQuery :(.
There is no unique stable identifier for each device or user (unless you generate one, and store it in e.g. local storage/cookies, and even then it could always be removed by the user and you'd regenerate one).
You seem to be looking for cookies, though, if you want to keep an user logged in on their device after having created an account.
I have a web application used internally by users to enter data. The product owners decided they want to remove the users ability to paste data into a prompt that is used to make them dual key the data entered. I know of no way (and found nothing through my searching) to implement this behavior in a prompt. The application does not use jQuery, just straight JS.
I recommended just disabling copy functionality for the entire page, but they specifically want to disable pasting into the prompt. Is this feasible? If so, how can I go about implementing it?
Not possible I'm afraid. prompt() is an API built by the browser, and much like alert(), once the popup window is opened it blocks processing on the page itself, so you have no way of knowing what keys/clicks the user has carried out on the popup, other than the text they enter into it which you receive in the response.
The Twitter input box is much more than your average INPUT or textarea. First off, it isn't an input or textarea at all. They are instead using a well crafted DIV with a "role" attribute. for the entire text; likely capturing keystokes as they occur.
If a user is logged in, they can compose a tweet. If during that very cautious 140 character sprint, they accidentally click somewhere on the page, the browser GETs another page.
But when the user hits "back", the DIV then repopulates (after a second), with the users partially drafted tweet.
In terms of browser capability, how is this "saved form field" being accomplished?
I'm guessing to achieve this, one could implement either:
local-storage
This would just involve writing to the local storage upon each keystroke. Upon loading the page, the JS populates the tweet composer with the session local storage. See a live example of utilizing local storage. This would be nice and slick, but a major limitation is that this is limited to HTML5 browsers.
AJAX callback
Similar to the first method, but instead of writing to local-storage, the draft tweet is written to a web service. Upon loading the page, a callback is made to retrieve the content; populating the tweet composer.
Cookie approach.
Similar to the local-storage, but would write to cookie cache. The benefit with this method might be more ubiquitous browser support.
I'd love for someone to explain the pro's/con's of each method along with some sample code. Bonus if it's under 140 characters for each code sample :) (j/k).
I have a code that is unique to my organization that was supplied by a third party, think coupon code. What i am wondering is, is it possible for me to auto fill the required input box so that the user doesn't have to?
The site is a third party site which i don't have control over and the user would get to this site by clicking on a link on our internal intranet site. I can see this being considered a vulnerability and so prevented, but i was just curious to see if there were any options.
Whether this is possible depends on the site in question. Many sites will extract parts of the query string and populate form fields from them. For example, a link to https://www.google.com/?q=foo will populate the Google search box with the value "foo".
Check whether the site in question does something similar. A good way to do this might be by submitting invalid values to their form and looking for the value you submitted in the query string (this works more often than you might think).
There's no possibility to interact between pages on different domains.
The simpliest way is to embed an iframe but browser will prevent a communication if target is on a different domain.
As it was said in the comments only reconfiguring browser (probably Webkit has an adequate overrides) or UserJS/Greasemonkey are the only solutions if you have no access to the target site.
I was just looking at this stackoverflow question: Display web browser settings
And that helps.
But, I'm curious if I can detect certain IE specific settings. I'm thinking some of the stuff in the Advanced Tab (e.g. Is 'Enable Integrated Windows Authentication' on)?
Or that our site was added as a Trusted Site? And within the Trusted Site settings, "Atomatic logon with current user name and password" is set?
I don't want to change them (I get that would be a huge issue that could be exploited). I just want to be able to present to the User:
"Hey, you need these couple of settings checked or unchecked for the site to work properly. Do this: a, b, c ... or Contact your Administrator".
Is this possible?
I don't think you can query these settings from within a web site. Being able to do so might introduce security holes.
I'm sure some settings can be determined by using circumstantial evidence (like if a JavaScript doesn't execute, scripting is probably disabled). But I don't think there is a proper API to poll every setting; I guess the best you can do is serve the user some advice on what to look for. (like, "The xyz symbol in the bottom right bar should show a green checkmark like so.... the abc checkbox in the options dialog should be unchecked... etc")
You can't check the settings directly, but you could test the functionality instead. If you attempt to authenticate with the server and find out you don't have their credentials passed in properly, you know it's not configured right. At this point you could show them your information about how to connect to the site. This would be a better solution anyways, as you're better off testing for features rather than specific settings.
To distill your question down, it looks like you're trying to find out whether IE is configured to automatically send NTLM credentials to your server.
Unfortunately, there's no way to cleanly feature-detect this. My initial thought was to put a JavaScript file in a protected directory that simply set a global variable, and link to that script in the <head>. (<script src="protected-dir/test.js"></script> – protected-dir would be configured only for integrated auth with anonymous auth off.) If the script loads, the variable is set; and if it fails, the variable obviously isn't. Another script on the page could check the variable and show a message if it's not set.
This works flawlessly when everything is configured correctly on a client, but when auto login is off, this causes an ugly 401 dialog to pop up, which is clearly no good. Additionally, a XHR request isn't the answer since the spec specifically says the browser should ask for credentials if it gets a 401.
Sadly, I don't think there's a way to automatically determine if auto login is enabled without causing the 401 dialog to pop up.