GuruEdzus Posted May 25 Report Share Posted May 25 Sveiki visiem. Vēlētos uzzināt, kā es varētu parsot citu lapu, lai iegūtu citas lapas contentu? Vēlams būtu ar javascript. Izmēģināju visādus variantus kā parsot, bet visu laiku met vienu un to pašu erroru. Access to fetch at '' from origin '' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. GET https://lapa.lv net::ERR_FAILED Uncaught (in promise) TypeError: Failed to fetch at <anonymous>:1:1 Ir kādam kādas idejas kā tomēr es varētu dabūt konkrētas lapas html dom? Precizējums - Vajadzētu tikai konkrētu elementu izdabūt no lapas Paldies jau iepriekš :) Quote Link to comment Share on other sites More sharing options...
briedis Posted Sunday at 10:28 AM Report Share Posted Sunday at 10:28 AM Nestrādās no pārlūka, ja vien tā lapa, kuru fetcho, to speciāli neatļaus (ar CORS headeri). Tas notiek tāpēc, pārlūks mēgīna pasargā tā lietotāju no "launiem" pieprasījumiem. Palasi: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.