-1

I am trying to search through an iFrame from a separate website.

One is my.website.com

Other is website.com

website.com is searching for text located in the iframe from my.website.com but its getting blocked by jquery. Is this blocked because its a different website? They are both the same domain.

I was looking at CORS headers to see if there was a way to allow jquery to search the text... Its dumb that its blocking even searching, its not manipulating anything.

Found this solution here: Cross sub domain iframes and JavaScript

How do I do this though. Where do I add the default.domain?

Tylerbns
  • 7
  • 1
  • possibly a duplicate of [Cross sub domain iframes and JavaScript](https://stackoverflow.com/questions/6046558/cross-sub-domain-iframes-and-javascript) – apsillers Nov 16 '17 at 17:25
  • That is my problem.. How do I add a document.domain to the webpage? – Tylerbns Nov 16 '17 at 17:29
  • sub domain isn't same domain. The more correct term to use though is *same origin*, because you can certainly have same domain cases that don't work for the same reason, because they don't have the same port and/or protocol. – Kevin B Nov 16 '17 at 17:57

1 Answers1

-1

You can access every variable of the parent window website.com in your case throught the window.parent object. Maybe you can try setting some variables of website.com with the following function inside my.website.com

document.onload = function () {
    if (window !== window.top && window.parent !== window) {
        // we're probably inside an iframe
        window.parent.someVariable = 'Some value!';
    }
};

And then you can call someVariable inside website.com

A reference to the parent of the current window or subframe.

If a window does not have a parent, its parent property is a reference to itself.

When a window is loaded in an , , or , its parent is the window with the element embedding the window.

Source: https://developer.mozilla.org/en-US/docs/Web/API/Window/parent