how to set all links in iframe to “google.com” by javascript or jQuery ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the iframe’s
contentWindowattribute to get a hold on the global object running in the iframe. From there you can do what you want.But if url of the iframe is on another domain, this will trigger a XSS (cross server scripting) error and you won’t be able to access the window dom. This is a security feature, so it cannot be circumvented. In other words, you cannot to that.