Page 1 of 2

How to terminate the "onClick" event after link opens in a browser window?

Posted: Mon Aug 11, 2014 4:04 pm
by R2R

I have a very simple issue with linking to a URL in a browser. I use the built-in "onClick" of link function to navigate to a URL which opens in a new tab. This works great, but once I return to the app, the loader keeps spinning and I can't do anything inside the app. I've attached an image showing the loader spinning after I've clicked on the link. How do you make the app active again after clicking on the link?

Link accessed in Safari browser:
Image

When I return to the app:
Image


How to terminate the "onClick" event after link opens in a browser window?

Posted: Mon Aug 11, 2014 5:05 pm
by Kateryna Grynko

Hi,

Are there any console errors? Please try debugging with Weinre: http://devcenter.appery.io/documentat...


How to terminate the "onClick" event after link opens in a browser window?

Posted: Mon Aug 11, 2014 5:17 pm
by R2R

Hi Katya, I've enabled Weinre debugging but I get an error in Weinre:

"You have no permission to view this project."


How to terminate the "onClick" event after link opens in a browser window?

Posted: Mon Aug 11, 2014 5:24 pm
by R2R

Katya, I used Chrome's debugging feature and received this error:

Image


How to terminate the "onClick" event after link opens in a browser window?

Posted: Mon Aug 11, 2014 9:10 pm
by Kateryna Grynko

Please click the error (VM1404:6) to see where it is in your code. Could you please post a screenshot with full error?


How to terminate the "onClick" event after link opens in a browser window?

Posted: Mon Aug 11, 2014 9:17 pm
by R2R

This is VM826:6 error (I'm guessing the error number changed since I launched the app again):

(function(win){win.respond={};respond.update=function(){};respond.mediaQueriesSupported=win.matchMedia&&win.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var doc=win.document,docElem=doc.documentElement,mediastyles=[],rules=[],appendedEls=[],parsedSheets={},resizeThrottle=30,head=doc.getElementsByTagName("head")[0]docElem,base=doc.getElementsByTagName("base")[0],links=head.getElementsByTagName("link"),requestQueue=[],ripCSS=function(){var sheets=links,sl=sheets.length,i=0,sheet,href,media,isCSS;for(;i Your browser is no longer supported. Click here to update... ').appendTo("#container")}jQuery(document).ready(function($){$("a[href=#scroll-top]").click(function(){$("html, body").animate({scrollTop:0},"slow");return false})});(function($){function Placeholder(input){this.input=input;if(input.attr("type")=="password"){this.handlePassword()}$(input[0].form).submit(function(){if(input.hasClass("placeholder")&&input[0].value==input.attr("placeholder")){input[0].value=""}})}Placeholder.prototype={show:function(loading){if(this.input[0].value===""(loading&&this.valueIsPlaceholder())){if(this.isPassword){try{this.input[0].setAttribute("type","text")}catch(e){this.input.before(this.fakePassword.show()).hide()}}this.input.addClass("placeholder");this.input[0].value=this.input.attr("placeholder")}},hide:function(){if(this.valueIsPlaceholder()&&this.input.hasClass("placeholder")){this.input.removeClass("placeholder");this.input[0].value="";if(this.isPassword){try{this.input[0].setAttribute("type","password")}catch(e){}this.input.show();this.input[0].focus()}}},valueIsPlaceholder:function(){return this.input[0].value==this.input.attr("placeholder")},handlePassword:function(){var input=this.input;input.attr("realType","password");this.isPassword=true;if($.browser.msie&&input[0].outerHTML){var fakeHTML=$(input[0].outerHTML.replace(/type=(['"])?password\1/gi,"type=$1text$1"));this.fakePassword=fakeHTML.val(input.attr("placeholder")).addClass("placeholder").focus(function(){input.trigger("focus");$(this).hide()});$(input[0].form).submit(function(){fakeHTML.remove();input.show()})}}};var NATIVE_SUPPORT=!!("placeholder" in document.createElement("input"));$.fn.placeholder=function(){return NATIVE_SUPPORT?this:this.each(function(){var input=$(this);var placeholder=new Placeholder(input);placeholder.show(true);input.focus(function(){placeholder.hide()});input.blur(function(){placeholder.show(false)});if($.browser.msie){$(window).load(function(){if(input.val()){input.removeClass("placeholder")}placeholder.show(true)});input.focus(function(){if(this.value==""){var range=this.createTextRange();range.collapse(true);range.moveStart("character",0);range.select()}})}})}})(jQuery);

And here's the image:

Image


How to terminate the "onClick" event after link opens in a browser window?

Posted: Tue Aug 12, 2014 2:32 am
by Yurii Orishchuk

Hi Artur,

1 To disable click event bubbling you can use following code in your "click" event handler after your code:

pre

Code: Select all

  //here is your code 

 //Here is code to disable bubbling. 
 arguments[0].preventDefault(); 
 arguments[0].stopPropagation(); 

/pre

2 Currently your console error is not clear for us. If you still have this problem and can not manage to fix it please give us your app public link and describe steps to reproduce this problem.

Regards.


How to terminate the "onClick" event after link opens in a browser window?

Posted: Tue Aug 12, 2014 12:36 pm
by R2R

Hi Yurii,

I have a link on the page in my app that opens a URL in a "new window." The only action available to me with a link is "Navigate to link." I can't add another action like Run Javascript and add the code you suggested. I'm demo-ing the app today, so I don't want to work on it today until our meeting is done. I can send you the page that's crashing the app after the meeting.

As always, thanks for your help!
Artur


How to terminate the "onClick" event after link opens in a browser window?

Posted: Tue Aug 12, 2014 12:40 pm
by R2R

Yurii, actually our demo isn't until Thursday - I just remembered our meeting was moved. Here's a public link to the app, and I've made the launch page the page with the link that's causing the issue. Simply click on the blue link on the first page. It will open a new window with a form. Click on the tab in which the app is open and you should see that the app is not responding and the loader is spinning.

http://appery.io/app/mobile-frame?src...


How to terminate the "onClick" event after link opens in a browser window?

Posted: Wed Aug 13, 2014 12:15 am
by Yurii Orishchuk

Hi Artur,

I've checked your link and see following mistake:

1 You use link component with href = "http://appery.io".

2 Besides you use click event handler on this component with action "navigate to link" action.

There is two solutions for you:

First solution:
1 Delete "click" event handler
2 Past goal URL into URL field of the link component. See details: http://prntscr.com/4c8vg1/direct

Second solution:
1 Just "disable" the link - put into URL link component property "javascript:" value.
See details: http://prntscr.com/4c8wcs/direct

Note these are two separate solutions. Thus don't combine them.

Regards.