Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Change window location href in subdomain iframe

I have a.example.com and b.example.com;

When I put b.example.com/foo as iframe in a.example.com:

<iframe src='b.example.com/foo'></iframe>`

the window.location.href value accessible from b.example.com is ... a.example.com/foo (??)...

The problem is - I use an external library in b.example.com/foo that checks for window.location.href and it gets incorrect information.

For this scenario it appears to me that I should iframe /foo content on a completely different domain like: anotherexample.com/foo, where the window.location.href would actually point to anotherexample.com/foo.

How can I force window object in iframe to actually use its subdomain instead of parent domain with added parameter?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Are you sure you are using your script in the right subdomain? it seems your external library is accessing parent window using window.parent.location, here is a code to check if a page is loaded directly or within another page:

var is_loaded_directly = (window.location == window.parent.location);

Since this code works, something is wrong on your setup or library.

Note: maybe you can solve your issue by checking document.location instead of window.location.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!