I have a form and I am using JavaScript to validate the form, so if we leave a field blank it will alert "Please Enter your Name".
If I go to the link directly, it works perfectly. But I am using an iFrame to embed it into other sites. When I embed it, and click Submit with an empty field it says:
The page at says: Please Enter your name
I have a form and I am using JavaScript to validate the form, so if we leave a field blank it will alert "Please Enter your Name".
If I go to the link directly, it works perfectly. But I am using an iFrame to embed it into other sites. When I embed it, and click Submit with an empty field it says:
Share Improve this question edited Nov 2, 2012 at 13:00 Anirudh Ramanathan 46.8k23 gold badges135 silver badges194 bronze badges asked Nov 2, 2012 at 12:58 vinayakvinayak 312 silver badges5 bronze badges 1The page at http://www.domain. says: Please Enter your name
- 1 I would swap the alerts for a placeholder for your error messages. This way at least things look consistent, less invasive and cleaner – user1171884 Commented Nov 2, 2012 at 13:01
1 Answer
Reset to default 5This is a security measure to prevent a framed site from displaying a message that appears to e from the parent site.
You cannot avoid it without avoiding the use of alert()
.
You could display the information to the user by modifying the DOM to display it as part of the page instead.