×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    6

    onClick event of an button page refreshes using web app

    Hi,

    I have an button on my html page , which computes some logic when user clicks an button. I have registered an function to onClick event of an button.

    like below :

    <input type="button" class="bn" id="box2" onclick="move(this,event);return false;"/>

    But this event refreshes the page , i want to avoid refreshing an page , is there any way i can avoid it.

    I also have event.preventDefault(); in my function to avoid refreshing an page but no luck

    Thanks for any help in advance.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,765

    Re: onClick event of an button page refreshes using web app

    JavaScript runs on a proxy server, this is why the page is refreshed. Only the MWL calls stay in the browser: http://developer.nokia.com/Resources...l-methods.html

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    6

    Re: onClick event of an button page refreshes using web app

    so can i use MWL to make a call to my function, as i cant find any example where we can call a js function using mwl

  4. #4
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    161

    Re: onClick event of an button page refreshes using web app

    Hi,
    you misunderstood the concept of MWL. It is a list of functions which can be used without a roundtrip. It cannot call any other function without a roundtrip.
    Basically all mwl does is adding or removing CSS classes. You can do a lot with it, if you use it clever, but if you don't tell us what you are trying to do, we can't tell you if it is possible or not.

  5. #5
    Registered User
    Join Date
    Mar 2013
    Posts
    6

    Re: onClick event of an button page refreshes using web app

    Take a simple scenario of calculator , adding the sum of two digits on a click of an button which will compute the logic of adding . How can i achieve computing logic with mwl here

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,765

    Re: onClick event of an button page refreshes using web app

    You may find the FAQ a good reading, http://developer.nokia.com/Community...web_apps_-_FAQ, it discusses JavaScript questions too: http://developer.nokia.com/Community...FAQ#JavaScript.
    In short: Web Apps do not execute JavaScript locally, and it is intentional. A thing what you can certainly do is leaving the Web App context using mwl.loadURL. Then the loaded page is treated as an ordinary web page, including that it runs JavaScript locally.

  7. #7
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    161

    Re: onClick event of an button page refreshes using web app

    Quote Originally Posted by wizard_hu_ View Post
    A thing what you can certainly do is leaving the Web App context using mwl.loadURL. Then the loaded page is treated as an ordinary web page, including that it runs JavaScript locally.
    Certainly not. Nokia xPress browser doesn't executes JavaScript locally. MWL is an addition.

    A calculator without refreshing the page will not be possible.

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,765

    Re: onClick event of an button page refreshes using web app

    Quote Originally Posted by lorion84 View Post
    Certainly not. Nokia xPress browser doesn't executes JavaScript locally.
    Note that I did not say a word about Nokia Xpress Browser here.

  9. #9
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    161

    Re: onClick event of an button page refreshes using web app

    There was no need for you to say it, since there is no other browser which could start (unless you mean this web kit garbage nobody ever would chose to use)

    And you would have no guarantee that the web kit browser starts. Nokia stopped shipping it.

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,765

    Re: onClick event of an button page refreshes using web app

    It may be worth mentioning here that so far no device models were mentioned in this discussion. You may find the featured post for this week interesting: http://developer.nokia.com/Blogs/Com...red-dibo-post/
    Last edited by wizard_hu_; 2013-07-30 at 19:24. Reason: Announcement linked as promised

  11. #11
    Regular Contributor
    Join Date
    Jun 2010
    Posts
    161

    Re: onClick event of an button page refreshes using web app

    Ah, thank you. But your tip for him is
    "Instead of making an Asha WebApp, make an Asha WebApp which opens a webpage, because on some devices it will start a very crappy old and now unsupported browser which won't do server-roundtrips!"

    I still would not recommend it. Oh, and I am pretty sure, that mwl.loadURL will always open the URL in the xPress browser, contrary to platformRequest().

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,765

    Re: onClick event of an button page refreshes using web app

    Quote Originally Posted by lorion84 View Post
    Oh, and I am pretty sure, that mwl.loadURL will always open the URL in the xPress browser, contrary to platformRequest().
    Yes, true. Accidentally I've just seen http://developer.nokia.com/Resources...s/loadurl.html an hour ago.

Similar Threads

  1. Cluster onclick event
    By Lundquist in forum [Archived] Maps API for Javascript
    Replies: 3
    Last Post: 2013-04-26, 10:59
  2. Change onclick-Event on the fly?
    By lorion84 in forum Nokia Asha Web Apps
    Replies: 3
    Last Post: 2013-04-03, 17:49
  3. Page refreshes when "Community" button is clicked
    By croozeus in forum Feedback on Forum Nokia's Renewal 2010
    Replies: 10
    Last Post: 2010-09-05, 16:21
  4. onClick getting wrong event
    By awysocki in forum Symbian
    Replies: 0
    Last Post: 2009-09-01, 22:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×