最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

JavaScript alert "the page says" - Stack Overflow

programmeradmin1浏览0评论

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:

The page at http://www.domain. says: Please Enter your name

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 1
  • 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
Add a ment  | 

1 Answer 1

Reset to default 5

This 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.

发布评论

评论列表(0)

  1. 暂无评论