Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chrome 25 iframe customize protocol don' twork

i have protocol (like http) with scheme managed with 3rd party App registered in android. I.e,someapp://someaction or something like that.

before upgrade chrome to latest version(chrome 25), it works fine, but after upgrade, it don't worked.

i just use iframe to try load the registered app. here is my code snapshot.

<iframe src="about:blank" id="myframe"/>
<script>
  function changesrc(){
    document.getElementById("myframe").src="someapp://someaction"
  }
</script> 

any ideas for this issue??

like image 945
fightf Avatar asked Nov 04 '22 02:11

fightf


1 Answers

We believe this is a potential for a security or malicious action bug and will not be implementing it in Chrome any longer. See https://code.google.com/p/chromium/issues/detail?id=169204#c27 for more details.

There is a solution, you can construct a special "intent" url that the user can invoke.

The basic syntax for an intent based URI is as follows:

“intent:”
    HOST/URI-path “;”  // Optional
        “#Intent;”
        package=[string];
        action=[string];
        category=[string];
        component=[string];
                    scheme=[string];
    “;end”

Parsing details available in the Android source.

To launch the Zxing barcode scanner app you can encode your href as follows intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end in an href on the anchor as follows Take a qr code

Extracted from : https://code.google.com/p/zxing/source/browse/trunk/android/AndroidManifest.xml#97

The android manifest defines the scheme to be “zxing”, the package to be “com.google.zxing.client.android” and the host data to be “scan” When the user clicks on this link they will taken straight to the app if they already have it installed, or if not directly to the play store.

like image 115
Kinlan Avatar answered Nov 09 '22 06:11

Kinlan