- Amlogic S905, S912 processzoros készülékek
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Milyen házat vegyek?
- Samsung Galaxy Tab S11 - tizenegyes
- Steam Deck
- Milyen TV-t vegyek?
- Vezeték nélküli fejhallgatók
- NVIDIA GeForce RTX 4060 / 4070 S/Ti/TiS (AD104/103)
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Meghalt a Windows 10, éljen a Windows 10!
-
PROHARDVER!
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
- Nagyon jó állapotú ASUS ROG Zephyrus G14 (2024) GA403UV-QS020W 1TB SSD, RTX 4060, 16GB RAM
- Bomba Ár! Lenovo ThinkPad L14 G2i - i5-1135G7 I 16GB I 256SSD I 14" FHD I Cam I W11 I Gar
- Bomba Ár! Lenovo ThinkPad L14 G2a - R5 4650U I 16GB I 256SSD I 14" FHD Touch I Cam I W11 I Gar
- Bomba ár! Lenovo ThinkPad L490 - i5-G8 I 16GB I 256SSD I 14" FHD Touch I HDMI I Cam I W11 I Gari!
- Bomba ár! Fujitsu LifeBook E544 - i5-4GEN I 8GB I 128SSD I 14" HD+ I DP I Cam I W10 I Garancia!
- HIBÁTLAN iPhone 15 Pro 256GB Blue Titanium -1 ÉV GARANCIA - Kártyafüggetlen, MS3506, 92% Akkumulátor
- AMD AM5 Setup! Akár kamatmentes rèszletre is! Èrdeklődj!
- Telefon felvásárlás!! Samsung Galaxy A70/Samsung Galaxy A71/Samsung Galaxy A72
- Samsung C27JG50QQU Monitor
- HIBÁTLAN iPhone SE 2020 64GB White -1 ÉV GARANCIA - Kártyafüggetlen, MS2025, 100% akkumulátor
Állásajánlatok
Cég: NetGo.hu Kft.
Város: Gödöllő
Cég: Laptopműhely Bt.
Város: Budapest