-1

i tried to load the page using XMLHttpRequest() but i got

blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

so i tried to load the page using something else so i used

object type="text/html" data="http://page/"></object>

it loaded the page in a small box . so i tried to define the page code to a constant so i be able to find a value from it's code using

let str = document.querySelector("body")

but it selected my page body not the page loaded using object . i tried the querySelector because

document.documentElement.innerHTML

have the same problem. if there a way to inspect elements to the correct page it would solve this . the page and console before inspecting the wanted area manually

enter image description here

the page and console after inspecting the wanted area manually

enter image description here

note: i can't edit the requested page

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
mina nageh
  • 143
  • 2
  • 2
  • 13
  • I don't really get what you are trying to do but regarding the CORS issue you can check https://stackoverflow.com/questions/20035101/why-does-my-javascript-code-get-a-no-access-control-allow-origin-header-is-pr – Yaki Jun 09 '19 at 16:18
  • "what you are trying to do" i am trying to get the value that's used to login to make an auto login script .. the link doesn't help a lot cause i am not using php or node ! – mina nageh Jun 09 '19 at 17:09
  • i just want to get it working using this object method ! – mina nageh Jun 09 '19 at 17:19
  • @Yaki for more info about what i am trying to do . [link](https://stackoverflow.com/questions/56503127/how-to-get-a-value-from-page-source-code-from-a-function-tag) – mina nageh Jun 09 '19 at 17:26

1 Answers1

0

You can't because objects ( Iframses ) have the cross domain policy too

mina nageh
  • 143
  • 2
  • 2
  • 13