javascript - IFrame get parameters from parent url on different domain -


it seems not possible default because error blocked frame origin x accessing frame origin y. know because of security allow partners integrate iframe. iframe on domain mysubdomain.mysite.com , contains search box. once user has made search has been redirected page partners-domain-containing-search-results.com search results on domain mysubdomain.mysite.com , read parameters url (hash , query string parameters) can't because can't read parent url parameters (from partners-domain-containing-search-results.com ).

you should able use top.location subdomain.mysite.com read parent urls of partners-domain-containing-search-results.com:

e.g. iframe hosted on mysubdomain.mysite.com , embedded in partners-domain-containing-search-results.com?hello=true#blabla should able run:

top.location.hash >"#blabla" top.location.search >"?hello=true" 

note: cannot modify other domain's location object or see:

uncaught securityerror: blocked frame origin "http://domain2.com" accessing frame origin "http://domain.com". protocols, domains, , ports must match.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -