Question

When implementing the "Connect to QuickBooks" button in my web application I found that it pops a new window instead of just being redirected, which is very undesired in the long run of this application. Is there any way to keep the button from popping a new window and just redirect in the same tab? Or would that go against Inuit's Do's and Don'ts (1. Don't modify the appearance or behavior of this button. 2. Don't modify the code that implements this button.)

I'm assuming the command to pop a new window is in Intuit's JavaScript anywhere() function but I didn't know if there was a way to prevent it from popping a new window and just make it use the same tab, without changing their code.

Or, if there really isn't anything would it be possible to close the popped up window automatically and resume control of the previously used tab? I tried to look this solution up but didn't find anything really, or at least nothing that worked for me.

Thanks for any help.

EDIT: I figured out how to close the the window...now it's just a matter of handling the refreshing the page it goes back to to something. I haven't quite figured out how it works yet but I ended up using:

<script type="text/javascript">
    try {
        var parentlocation = window.parent.opener.location.hostname;
        var currentlocation = window.location.hostname;
        if (parentlocation != currentlocation) {
            window.location = "/default.aspx";
        }
        else {
            window.opener.location.href = window.opener.location.href;
            window.close();
        }
    }
    catch (e) {
        window.location = "/default.aspx";
    }
</script>

If someone wouldn't mind explaining that code that would be awesome, but nobody has to. I just can't right now so I'll do it later on my own.

Was it helpful?

Solution

I found that it pops a new window instead of just being redirected,

Yep, this is what Intuit wants it to do.

Is there any way to keep the button from popping a new window and just redirect in the same tab?

Nope.

Trying to do that is a great way to get Intuit to ban your application/remove it from AppCenter.

Or, if there really isn't anything would it be possible to close the popped up window automatically and resume control of the previously used tab?

Of course. In fact, you'll have to if you want to publish on AppCenter.

Simple Javascript - window.close();

Keep in mind that this window only has to be opened once and then never again. It's not like this is going to be a huge inconvenience to your users when they'll only need to do this once in the entire history of ever using your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top