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

148
Views
Can I get a parameter from shortened URL through an Iframe?

I have shortened URL's scanned from QRCODES. The full URL has some parameters that I need.

I'm putting up an Iframe to load the shortened URL and was hoping to get the "full" url once it loaded.

But didn't get to work...

Is it possible?

Once the Iframe is loaded, I try access it using:

iframe.contentWindow.location.href

But always get an error

ERROR DOMException: Blocked a frame with origin "http://localhost:8100" from accessing a cross-origin frame.

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

0

There are solutions to the communication between iframe and host if you control the content of both windows, but they often feel like hacks and can be limiting.

For a general solution, you could get the redirected URL before you even load the iframe.

The fetch api has a "redirect" option you can set to "manual" to get the URL it redirects to.

fetch(shorturl, {redirect: "manual"})
   .then(function(response) {
       var iframeurl;
       if (response.type==="opaqueredirect") {
           // set to redirected url
           iframeurl = response.url
       }
       else {
           // use original url.
           iframeurl = shorturl
       }
       iframe.contentWindow.location.href = iframeurl;
       handleQueryString(iframeurl)


   })

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!