0

I have this page

<html>
<body>
<script>
document.domain = "yandex.ru";
</script>
<a href="/video">video</a>
</body>
</html>

Sadly, still have link in HTML like /video, instead of yandex.ru/video. P.S.: links are relative type and don't depends from myself. In certain cases (not all though) - they are incorparated in iframes.

Areso
  • 67
  • 1
  • 2
  • 11
  • have you read this: https://stackoverflow.com/questions/2600709/changing-document-domain-to-completely-other-domain ? – Talgat Nov 27 '17 at 04:16
  • Well, I had read about same-origin and SCP, but I don't think it could be a related to my case, because in my example there is no domain at all in the link. Second, probably there are some other ways to use JS/DOM, which allow me to use my variable with value "yandex.ru" as prefix to any relative links on my page or in my iframe. – Areso Nov 27 '17 at 04:50
  • Try to get local domain and sustitute the string like replace String function and put new address – Talgat Nov 27 '17 at 04:52
  • Could you point me to an example? I'm a new to JS. Is local domain different from document.domain, or I should manipulate (str replace) with document.domain? – Areso Nov 27 '17 at 04:55
  • Sorry, I haven't done this as well. Please look through this link, maybe it will help you: https://www.w3schools.com/jsref/dom_obj_document.asp – Talgat Nov 27 '17 at 05:45

0 Answers0