Wikipedia:Reference desk/Archives/Computing/2021 February 24
Computing desk | ||
---|---|---|
< February 23 | << Jan | February | Mar >> | Current desk > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
February 24
[edit]JavaScript inserted to DOM via jQuery executing
[edit]Yesterday at work I was developing an ASP.NET MVC page which uses jQuery on the front end. The jQuery code sends an AJAX request to the controller, which then returns a piece of HTML code, which jQuery then inserts directly to the DOM on the browser.
Now this HTML code includes a <script>
node containing JavaScript code, which includes a document.ready()
call. To my surprise, this JavaScript code executed as it got placed into the DOM. I was under the impression that JavaScript code in the DOM is only executed when the a full page request is done and the DOM is built up in the first place.
This is so much the better, as it's the behaviour I was intending, but my question is: Is this standard or somehow browser-specific (I was using Firefox 84 on Windows 10)? JIP | Talk 00:13, 24 February 2021 (UTC)
- If you do it properly, the script will be a script and can be executed. You need to create a script node, populate the node, and append it to the DOM. I've seen programmers try to cram a script into innerHTML attributes. That won't work. It isn't a proper script node. 97.82.165.112 (talk) 12:02, 24 February 2021 (UTC)
- JIP, yes this is standard, and actually one of the more dangerous parts of jquery, which doesn't protect you from unintentionally inserting scripts this way. As such, it is always advised to use jQuery.parseHTML to preprocess any HTML fragments and allows you to make this choice of keeping scripts or filtering them out explicit, before adding them to the DOM. —TheDJ (talk • contribs) 09:54, 25 February 2021 (UTC)
- Thank you for the answer, this was what I was hoping for. I don't think it's really that dangerous in this particular context, because the jQuery code is downloading HTML from the exact same web application where the jQuery code itself came from, and this application has complete control over the contents of the HTML. Of course I understand that if the jQuery code were to just download HTML from some random place on the Internet it would open the application to all sorts of dangers. JIP | Talk 01:07, 28 February 2021 (UTC)
Free pdf reader
[edit]My Adobe Acrobat pdf reader has begun to show weird things. I haven't updated it for years, so perhaps it shows its age. I decided to upgrade it, checked with the Google and lo and behold there is no free Acrobat anymore. This software which I may use once in two months will cost me $13 a month. My daughter said - there are no more free things anymore. I recall that there have been pdf readers made by other developers and they had been available for downloading.
Is there a way to get a free pdf reader somewhere? Thanks, - AboutFace 22 (talk) 17:27, 24 February 2021 (UTC)
- @AboutFace 22: There is still a free version of Acrobat Reader [1]. There is also a "pro" version which has a cost and is likely what you found first, as did I. Another free reader is Foxit [2]. RudolfRed (talk) 17:46, 24 February 2021 (UTC)
@RudolfRed thank you. I did find the correct "free" version of Acrobat previously too, but when I began installing it it first installed McAfee Security Suite. McAfee is not free and I don't want it to mess with my Spy Bot Search and Destroy that has been working well in my machine for years. I did not ask Adobe to install McAfee. The whole experience was just weird. In the end I "installed" Acrobat and immediately uninstalled McAfee. Will see how it is going to work out. Thanks, AboutFace 22 (talk) 19:40, 24 February 2021 (UTC)
- If you don't want McAfee Security Suite then choose the option not to install it. (Deselect the relevant tick boxes before downloading.) You should always pay attention when downloading and installing software especially free (as in gratis) software nowadays since plenty of software now includes such optout components. Nil Einne (talk) 19:50, 24 February 2021 (UTC)
Linux systems may have okular or evince. I don't know if either is available for other computers. Of the two I prefer okular. --142.112.149.107 (talk) 21:27, 24 February 2021 (UTC)
- AboutFace 22. There are loads of free PDF readers. See List of PDF software. For what it's worth, I use Sumatra PDF.--Shantavira|feed me 08:45, 25 February 2021 (UTC)
Many thanks to everyone who contributed. AboutFace 22 (talk) 21:29, 25 February 2021 (UTC)
Free alternative to MS Office for MacBook Pro 2020
[edit]My Dad's just upgraded to a MacBook Pro 2020. His old installation of MS Office can't be transferred over to it. He doesn't need all the latest whistles and bells. Could anyone recommend a decent free alternative for domestic use? Thanks, DuncanHill (talk) 20:36, 24 February 2021 (UTC)
- @DuncanHill: There is Apache OpenOffice and LibreOffice. There is also a list at Comparison_of_word_processors, but not all will be free. It's also possible the new computer came with Pages (word processor) from Apple. RudolfRed (talk) 20:47, 24 February 2021 (UTC)
- MS Office doesn't run well on a Mac. It's not properly designed to do so and there are several features missing. I recommend you use Pages.--Shantavira|feed me 08:56, 25 February 2021 (UTC)