[
https://issues.apache.org/jira/browse/CB-4330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855727#comment-13855727
]
ASF subversion and git services commented on CB-4330:
-----------------------------------------------------
Commit 0fd177b97e8bac15e524eeba6704c2244bb97af2 in branch refs/heads/master
from [~agrieve]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-mobile-spec.git;h=0fd177b ]
CB-4330 Add test pages that change hashes
> handleOpenURL called twice in certain cases
> -------------------------------------------
>
> Key: CB-4330
> URL: https://issues.apache.org/jira/browse/CB-4330
> Project: Apache Cordova
> Issue Type: Bug
> Components: iOS
> Affects Versions: 2.9.0
> Reporter: Jacob Weber
> Assignee: Shazron Abdullah
>
> I have an app with a custom URL protocol handler. If I load it via the custom
> URL, it calls my handleOpenURL JS function, as expected. But if I then change
> window.location.hash, and then load another URL in an iframe, handleOpenURL
> is called again with the same URL.
> 1. Create an iOS project according to the docs
> (http://cordova.apache.org/docs/en/2.9.0/guide_getting-started_ios_index.md.html#iOS%20Platform%20Guide)
> 2. Add this to the bottom of index.html, before the </body> tag:
> {noformat}<button id="test">test</button>
> <script type="text/javascript">
> function handleOpenURL(url) {
> console.log(url);
> }
> var test = document.getElementById('test');
> test.addEventListener('click', function() {
> window.location.hash = 'foo';
> var frame = document.createElement('iframe');
> frame.src = 'img/logo.png';
> document.body.appendChild(frame);
> }, false);
> </script>{noformat}
> 3. Add this to the end of your HelloWorld-Info.plist file:
> {noformat}<key>CFBundleURLTypes</key>
> <array>
> <dict>
> <key>CFBundleURLName</key>
> <string>com.mycompany.myscheme</string>
> <key>CFBundleURLSchemes</key>
> <array>
> <string>sample</string>
> </array>
> </dict>
> </array>{noformat}
> 4. Run the app.
> 5. Create a web page somewhere outside of the app, with a link like this:
> {noformat}<a href="sample://page">(sample)</a>{noformat}
> 6. Open the page in Safari and click the link.
> 7. The app will open, and in XCode's console, you'll see "handleOpenURL:
> sample://page".
> 8. Now click the "test" button in the app. This will change
> window.location.hash, and create an iframe.
> 9. In XCode's console, you'll see a second "handleOpenURL: sample://page",
> which shouldn't happen.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)