- Motorola Edge 50 Neo - az egyensúly gyengesége
- iPhone topik
- Xiaomi 14T Pro - teljes a család?
- Yettel topik
- Google Pixel topik
- Google Pixel 10 Pro XL – tíz kicsi Pixel
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Meglepetés az iPhone Air hajlítópróbáján
- Apple Watch Sport - ez is csak egy okosóra
- Samsung Galaxy S25 - végre van kicsi!
-
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
- Intel Core i5 / i7 / i9 "Alder Lake-Raptor Lake/Refresh" (LGA1700)
- Audi, Cupra, Seat, Skoda, Volkswagen topik
- Eredeti játékok OFF topik
- Suzuki topik
- Székesfehérvár és környéke adok-veszek-beszélgetek
- AliExpress tapasztalatok
- Motorola Edge 50 Neo - az egyensúly gyengesége
- VGA kibeszélő offtopik
- eBay
- iPhone topik
- További aktív témák...
- 5530 15.6" FHD IPS i5-1235U 16GB 256GB NVMe magyar vbill ujjlolv IR kam gar
- AMD RYZEN 3 - 5 / DDR4 / NVME SSD / HDMI / Normál magas vga is rakhato bele , nem SFF méret
- X1 Yoga 6th 14" 4K+ IPS érintői7-1185G7 16GB 256GB NVMe ujjlolv IR kam aktív toll gar
- Gamer PC-Számítógép! Csere-Beszámítás! I7 12700E / RTX 3070Ti / 32GB DDR5 / 1 TB SSD
- SAMSUNG Odyssey 49" OLED G9 LS49DG950SUXDU monitor - 240hz
- BESZÁMÍTÁS! MSI B450 R7 5800X 32GB DDR4 1TB SSD RTX 4070Ti 12GB Zalman S2 TG Enermax 750W
- Xiaomi Redmi Note 13 Pro+ 512GB, Kártyafüggetlen, 1 Év Garanciával
- ÁRGARANCIA!Épített KomPhone Ryzen 5 5600X 16/32/64GB RAM RX 9060 XT 8GB GAMER PC termékbeszámítással
- HIBÁTLAN iPhone 12 Pro Max 256GB Gold -1 ÉV GARANCIA - Kártyafüggetlen, MS3106, 100% Akkumulátor
- AKCIÓ! Apple MacBook Pro 16 M4 Max 36GB RAM 1TB SSD macbook garanciával hibátlan működéssel
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: CAMERA-PRO Hungary Kft.
Város: Budapest