views:

39

answers:

3

Hi, I am building a web application and I need to create a feedback form widget so the users can put it in their websites and all the submitted data will be saved in my web application. I also need to have authentication in the widget before the user can submit the information (using my application login form or a facebook account for example).

I have never build something like this. What is the best way?. I am not really conformtable with raw javascript. But if i use jquery it may conflict with the client´s page. And what about cross domain requests?.

Note that the first version of my widget should be in a popup.

Thanks for your help.

+1  A: 

In your case I would recommend using an <iframe>. It should prevent any javascript conflicts occuring between your frame and the parent website, as well as been widely supported across all major web browsers.

You should then be able to open a popup window using the window.open method. I'd be cautious with popup windows as there is no reliable cross browser method to detect if a popup has been blocked, which may leave users confused.

Andrew Dunn
A: 

If it's a popup you can simply open on of those opening the feedback page on your webapp...

<head>
    <script type="text/javascript">
         function mypopup(url) {
              mypopup = window.open(
                 url,  
                 "mypopup",
                 "width=600,height=400,status=yes,scrollbars=yes,resizable=yes"
              );
              mypopup.focus();
         }
    </script>
</head>
<body>
    <a href="#" onclick="mypopup('http://example.com/feedbackform');"&gt;
       Open Feedback Form
    </a>
</body>
Tim
+1  A: 

Or, if an iframe or popup window are not what you had in mind, you can still do this with AJAX, but you'll need to use JSONP or set the Access-Control-Allow-Origin header in all of your responses.

However, that said, your best bet is probably an iframe. This allows you to roll out bug fixes immediately and doesn't rely on the client to update their client to the latest version.

Justin Johnson