sushil bharwani
sushil bharwani

Reputation: 30187

How can i get the hash value from an iframe src?

My iframe is having a url with a hash value when i do iframe.src it just gives me the url without the hash appended to it from the other domain. Can i read the entire url with the hash.

Upvotes: 4

Views: 8566

Answers (2)

mplungjan
mplungjan

Reputation: 178079

Not likely due to security constraints - I am surprised you can even get the URL

Can you show the code?

Sounds like a duplicate of How to get iframe contentWindow height in cross domain

Upvotes: 2

Calum
Calum

Reputation: 5316

var contentWnd = $('iframe').attr('contentWindow');
var hash = contentWnd.window.location.hash;

Adaptation of this answer: Get url from iframe and update hash in browser url

Upvotes: 2

Related Questions