- Samsung Galaxy A55 - új év, régi stratégia
- CMF Phone 2 Pro - a százezer forintos kérdés
- Yettel topik
- Motorola Edge 50 Ultra - szépen kifaragták
- Samsung Galaxy S23 és S23+ - ami belül van, az számít igazán
- Garmin topik
- Külföldi SIM-ek itthon
- Azonnali mobilos kérdések órája
- One mobilszolgáltatások
- Samsung Galaxy Watch (Tizen és Wear OS) ingyenes számlapok, kupon kódok
-
Mobilarena
JavaScript != Java (A JavaScript nem összekeverendő a Javával, két különböző programozási nyelvről van szó!)
Új hozzászólás Aktív témák
-
Sk8erPeter
nagyúr
Szívesen!
Innen érthető meg elég jól, mit is csinál a JSON.parse(), lényegében hasonló az eval()-hoz, csak az a nagy különbség, hogy a JSON.parse() nem engedi lefutni pl. az esetlegesen kártékony JavaScript-kódot. Az eval()-nak pedig épp ez a nagy veszélye, hogy rajta keresztül lefuthatnak a rosszindulatú kódok.
Idézet:
"To convert a JSON text into an object, you can use the eval() function. eval() invokes the JavaScript compiler. Since JSON is a proper subset of JavaScript, the compiler will correctly parse the text and produce an object structure. The text must be wrapped in parens to avoid tripping on an ambiguity in JavaScript's syntax.
var myObject = eval('(' + myJSONtext + ')');The eval function is very fast. However, it can compile and execute any JavaScript program, so there can be security issues. The use of eval is indicated when the source is trusted and competent. It is much safer to use a JSON parser. In web applications over XMLHttpRequest, communication is permitted only to the same origin that provide that page, so it is trusted. But it might not be competent. If the server is not rigorous in its JSON encoding, or if it does not scrupulously validate all of its inputs, then it could deliver invalid JSON text that could be carrying dangerous script. The eval function would execute the script, unleashing its malice.
To defend against this, a JSON parser should be used. A JSON parser will recognize only JSON text, rejecting all scripts. In browsers that provide native JSON support, JSON parsers are also much faster than eval. It is expected that native JSON support will be included in the next ECMAScript standard.
var myObject = JSON.parse(myJSONtext, reviver);"
Új hozzászólás Aktív témák
- ASUS blog: Ideális olcsó utazós gép lett az új Vivobook S14
- Nintendo Switch 2
- Villanyszerelés
- Milyen notebookot vegyek?
- Path of Exile (ARPG)
- Samsung Galaxy A55 - új év, régi stratégia
- Windows 11
- Kerékpárosok, bringások ide!
- CMF Phone 2 Pro - a százezer forintos kérdés
- Androidos tablet topic
- További aktív témák...
- Remek áron Lenovo Flex 5 14 laptop/2in1/Touch/Ryzen i5-1135G7/8GB/512 GB SSD/14"/Gari
- Exclusive ajánlat! Dobozos új LG GRAM /13. gen i7-1360P/32GB RAM/512GB SSD/14"COL/FHD+/IPS/Garancia/
- Pénztárcakímélő áron eladó HP Pavilion laptop/I5-1135G7 8GB 256SSD 13" FHD IPS Gari
- Samsung Galaxy Book 3 /i5-1335u/8GB/512SSD/FHD/Garancia/ 6 napot ment eddig összesen
- Xiaomi Redmi Note 14 Pro Plus 12/512GB Újszerű,Dobozos,Kétkártyás 1év Garanciával!
- Wilbur Smith könyvek (15 db) egyben
- BESZÁMÍTÁS! Asus H110M i5 7400 8GB DDR4 250GB SSD 1TB HDD GTX 1650 4GB ZALMAN S3 TG Chieftec 600W
- VÉGKIÁRUSÍTÁS - REFURBISHED - Lenovo ThinkPad 40A9 docking station
- Újszerű Apple Macbook Air 13 - M2 - 30 Ciklus - 100% Akkumulátor - 8GB/256GB SSD - MAGYAR - Éjfekete
- Telefon felváráslás!! Samsung Galaxy S22/Samsung Galaxy S22+/Samsung Galaxy S22 Ultra
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged