Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7764141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:50:07+00:00 2026-06-01T14:50:07+00:00

PhoneGap Build provides a service (currently free during beta) where they take your HTML+JS+CSS

  • 0

PhoneGap Build provides a service (currently free during beta) where they take your HTML+JS+CSS source, along with an XML file to configure build options (config.xml), and do server-side builds for all supported platforms (iOS, Android, Blackberry, Symbian, WebOS), which is a huge time saver and saves me tons of money on headache medicine.

Unfortunately, there is inconsistent behavior with the way links to external websites work:

Currently in order to have links open in an external browser, it requires uploading different code to PhoneGap Build. For iOS the domain must be whitelisted, and for Android the domain must be unlisted.

You could make it consistent by adding an attribute to the access tag, like includeForAndroid="false", which would NOT include the access tag contents on Android, so that links would open in an external browser, just like on iOS.

Config.xml docs; and here’s a relevant blog post.

While there is a proposed fix by an employee, it has yet to be made and released in the product:

We’re hoping to get this straightened out in Cordova open source project: in the meantime, for PhoneGap Build, I’m thinking something like this:

<access origin="*" onlyInBrowser="true" />

That will not include the tag on Android, but will on iOS.

Until this change is made and available in the product, the work-around is to make two zip files that I will upload: one for Android (without the access tags) and one for iOS (with the access tags). Not ideal, but it’s what must be done for consistent app behavior.

I’m already using ANT to automate many tasks within this project, so it would be ideal if ANT could do the config.xml updates for me too.

For reference, here’s my ANT code that would build the two zips:

<target name="BUILD-ZIP" depends="verify-using-minified-js,prepare-for-build">

    <tstamp>
        <format property="build.tstamp" pattern="yyyy-MM-dd__HH-mm-ss" />
    </tstamp>
    
    <antcall target="zip-ios">
        <param name="tstamp" value="${build.tstamp}" />
    </antcall>
    
    <!-- build android second so that we can just remove the access tags -->
    <antcall target="zip-android">
        <param name="tstamp" value="${build.tstamp}" />
    </antcall>
        
</target>

<target name="zip-ios">
    <zip destfile="${dir.pkg.phonegap}${tstamp}-apple.zip">
        <zipfileset dir="${dir.pkg.tmp}">
            <exclude name="build.xml" />
            <exclude name="build.properties" />
            <exclude name="settings.xml" />
            <exclude name=".project" />
            <exclude name="**/*.psd" />
            <exclude name="assets/js/app.js" />
            <exclude name="assets/js/cordova-1.5.0.js" />
        </zipfileset>
    </zip>
</target>

<target name="zip-android">
    
    <!-- before building android zip, get rid of the <access> tags -->
    
    <zip destfile="${dir.pkg.phonegap}${tstamp}-android.zip">
        <zipfileset dir="${dir.pkg.tmp}">
            <exclude name="build.xml" />
            <exclude name="build.properties" />
            <exclude name="settings.xml" />
            <exclude name=".project" />
            <exclude name="**/*.psd" />
            <exclude name="assets/js/app.js" />
            <exclude name="assets/js/cordova-1.5.0.js" />
        </zipfileset>
    </zip>
</target>
    
<target name="prepare-for-build">
    
    <!-- increment build number -->
    <propertyfile file="build.properties">
        <entry key="version.build.number" type="int" operation="+" default="1"/>
    </propertyfile>
    <property file="build.properties"/>
    <echo message="BUILD NUMBER: ${version.build.number}"/>
    
    <delete includeemptydirs="true" verbose="false">
        <fileset dir="${dir.pkg.tmp}" includes="**/*"/>
    </delete>
    <filter token="BUILD_NUMBER" value="${version.build.number}" />
    <filter token="VERSION_MAJOR" value="${version.major}" />
    <filter token="VERSION_MINOR" value="${version.minor}" />
    <copy todir="${dir.pkg.tmp}" verbose="true" overwrite="true" filtering="true">
        <fileset dir="${dir.dev}" includes="**/*" />
    </copy>
    
</target>

There’s a comment in there, in the zip-android target:

<!-- before building android zip, get rid of the <access> tags -->

This is where I want to do the replacement. I’ve tried using the <filter> task as well as <replace> and <replaceRegExp>, but I can’t seem to find a way to do it, and it all boils down to the fact that I need to replace the string: <access ... /> and none of these replacement methods seem to allow < or > in the token/match/etc attributes. I’ve tried using CDATA, but couldn’t get that working either.

The closest I’ve come, in that ANT doesn’t throw any errors, is this:

<replace file="${dir.pkg.tmp}config.xml" failOnNoReplacements="true">
    <replacetoken>
        <![CDATA[<access origin="http://example.com" subdomains="true" />]]>
    </replacetoken>
</replace>

In theory, this would replace the specified <access ... /> tag with an empty string, because I’ve omitted the value attribute.

Unfortunately, it fails because of the failOnNoReplacements attribute and the fact that, for whatever reason, it’s not doing any replacements.

Is this possible? If so, what am I doing wrong?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:50:08+00:00Added an answer on June 1, 2026 at 2:50 pm

    Ha, I managed to put together a solution that gets around the blocking of angle brackets.

    In config.xml:

    <!--access_tag1_here-->
    

    In build.xml:

    <replace 
        file="${dir.pkg.tmp}config.xml" 
        failOnNoReplacements="true"
        token="!--access_tag1_here--" 
        value="access origin='http://example.com' subdomains='true' /"
        />
    

    This transforms the comment into the necessary access tag.

    I switched my zip order so that Android now goes first while the comments are still comments, and then the iOS zip process inserts the access tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The PhoneGap build service says you can build an app in HTML5, CSS, and
As I understand we give PhoneGap Build the 'www' folder with our Html, Css
I'm building an app in html/css/javascript and using phonegap to build. So, I first
I am building an app using Phonegap Build. HTML,CSS,JS ... I want the app
Does anybody have experience build app with PhoneGap's Build Service? I followed the steps
Is it possible to use Phonegap's Build service to build projects that may have
I'm looking at the PhoneGap documentation on including plugins into your PhoneGap Build ,
I am currently starting to build an PhoneGap application, I know the advantages of
I have an HTML5/Javascript app, and I have used PhoneGap's build service to generate
I'm building my application using PhoneGap Build and all builds are ok with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.