facebook

XMLHttpRequest problem

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #318717 Reply

    SonamGyato
    Member

    I’ve getting data from a remote server using XMLHttpRequest.

    When i test the app within the test environment it works fine.

    then when i upload the app to mobi-server and then test in
    the test environment (and the iphone) i get a XMLHttpRequest
    status result of 0. (see attached image)

    XMLhttprequest seems to set the status to 0 if there’s a
    cross-domain request. that’s why the url that i do an http
    GET on, sets the header

    Access-Control-Allow-Origin to *

    so that should not be a problem – since i’ve confirmed this when
    testing in the test env.

    the problem is when i package the webapp and then send it
    to the iphone and also the test-env. that’s when i get the
    status=0 message.

    Attachments:
    You must be logged in to view attached files.
    #318719

    SonamGyato
    Member

    I ran the same script from a test html file from the
    emulator browser and it worked also – i.e. doing
    the cross-domain XHR call.

    The problem seems to occur when the app is packaged
    and sent to the phone or the emulator.

    #318730

    SonamGyato
    Member

    i think i got this problem solved.

    if i test the app using the test-center – the XHR works.

    if i package it and send to mobi server or have to sent
    to the emulator using the send-to-my-phone feature, the
    XHR does not work.

    i used the Export HTML feature and uploaded all the files
    to my server (a different domain than the one the XHR calls)
    and now it seems to work.

    #318743

    support-michael
    Keymaster

    @everest
    We are investigating this further to see if the Test Center is setting the COR headers correctly. I will follow up with you once we know a bit more.

    #318763

    SonamGyato
    Member

    cross-domain XHR calls don’t seem to be working.

    I’ve added http header on the cross-domain url

    Access-Control-Allow-Origin set to asterisk

    so the XHR call should work.

    Please try to resolve this asap because i’m dead in the
    water right now.

    if you’d like i can send you a sample app.

    #318769

    support-michael
    Keymaster

    @everest

    We did more investigation yesterday. Try the following:

    1) goto the Window>Settings>Local Web Server and enable it
    – see if COR works

    2) if you app is configured for offline support then try either disabling AppCache support (temporarily)
    – see if COR works

    3) if #1 and #2 not working then please send me a sample app and we will resolve this at once. You can send it to support at genuitec dot com to my attention

    #318772

    SonamGyato
    Member

    i tried #1 and the XHR works.

    I like to do the test cycle by clicking on the right green
    arrow….the problem with enabling the local server is that
    any changes i make to the _custom.js file is not reflected
    in the test env.

    #318774

    support-michael
    Keymaster

    @everest

    > with enabling the local server is that any changes i make to the _custom.js file is not reflected in the test env.

    How are you editing the custom.js file? For example are you opening the js using the Test Center’s View Source editor or are you using an external editor such as notepad?

    If you use an external editor then you need to reload the web page to pickup recent changes to any of the web files (html, css, js). The Test Center includes a “reload” button on the toolbar and the right-click context menu.

    #318777

    SonamGyato
    Member

    yes i do use an external editor…didn’t know there was an internal
    editor.

    i’m pretty sure i refreshed the .html – but i could be wrong.

    i’ll keep an eye on this.

    fyi, when i use the Export HTML feature – it exports the skeleton
    ??_custom.js file.

    I think if the file exists in the exports folder – it should export
    that custom file.

    also, any chance to add an option to obfuscate the custom.js.

    #318779

    support-michael
    Keymaster

    @everest
    >I think if the file exists in the exports folder – it should export that custom file.

    This is a good pt. I opened a bug for this.

    The issue is that Run in Test Center was meant to be a quick test/feedback mechanism with the generated code sort of out of sight and not central to UI mockup process. What we have learned is that working with project_export/ code is more the primary method and Export HTML is used much less that originally envisioned. The plan to address this is to introduce a project concept in the next couple of months that makes it much easier to tie together the UI design process and manual coded resources in a unified environment.

    We can also make obfuscation completely configurable as part of the project support.

    #318794

    SonamGyato
    Member

    > We can also make obfuscation completely configurable as part of the project support.

    please add this ASAP!!!

    i’ve found this tool quite useful and plan to create a pay-4-app and do not wish people
    to just steal the code.

    i think many others would also find it useful.

    #318837

    support-michael
    Keymaster

    I discussed this feature with dev team. I added it to our enhancement tracking system. Should be doable but will need to get it scheduled for a release.

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: XMLHttpRequest problem

You must be logged in to post in the forum log in