I'm new to Dojo for a couple of months and just come across some difficulties with dojo iframe.
What I am trying to do now is to create an iframe element using dojo/request/iframe
and load a <div>
element from remote url, but what I found from the web page is pretty complex, that I don't know how to grab it.
I've tried the following code:
iframeRequest.post(url, {handleAs: 'html'}).then(function(response) {
response.querySelector('div[id=idx_layout_BorderContainer_5]')
})
But it doesn't work, and specifying the element id seems not precise enough to load what I need as I noticed that the target element id changes every time when I load the page.
So I'am asking the below questions:
- How am I able to locate the correct element from a remote webpage?
- Is the syntax used to load the content correct?
Really appreciated for your help!
EDIT: To be clear I actually came across the following questions to look for a workaround:
How do I crop the contents of an Iframe to show a part of a page?
But the solution looks pretty dumb and that is immune to some browser events. Any ideas?