ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î

addJavascriptInterface ¿À·ù(Android WebView.addJavascriptInterface not Working)
7³â Àü
°©Àڱ⠾ȵǴ WebView.addJavascriptInterface ÀÇ ¿øÀÎÀº Á©¸®ºó MR1 ¾÷µ¥ÀÌÆ®ºÎÅÍ ÀÚ¹Ù½ºÅ©¸³Æ®¿¡ °ø°³ÇÒ ÇÔ¼ö¿¡ ´ëÇØ ÁÖ¼®(annotated)ÇØÁà¾ß Çϱ⠶§¹®À̾ú´Ù.


http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)

Injects the supplied Java object into this WebView. The object is injected into the JavaScript context of the main frame, using the supplied name. This allows the Java object's methods to be accessed from JavaScript. For applications targeted to API level JELLY_BEAN_MR1 and above, only public methods that are annotated with JavascriptInterface can be accessed from JavaScript. For applications targeted to API level JELLY_BEAN or below, all public methods (including the inherited ones) can be accessed, see the important security note below for implications.

¿¹½Ã

class JsObject {
   //Áß¿äÇÑ ÁÖ¼®Ç¥½Ã(¾î³ëÅ×À̼Ç)
   @JavascriptInterface
   public String toString() { return "injectedObject"; }
}
webView.addJavascriptInterface(new JsObject(), "injectedObject");
webView.loadData("", "text/html", null);
webView.loadUrl("javascript:alert(injectedObject.toString())");

ÃßõÃßõ : 267 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,196
Service & Notification(¾Ë¸²¹Ù¶ç¿ì±â) ÀÌ¿ëÇϱâ
1,195
È­¸é ȸÀü(rotation) ó¸®
1,194
[Android] Àüüȭ¸é, title bar ¾ø¾Ö±â, status bar ¾ø¾Ö±â
1,193
ANDROID(¾Èµå·ÎÀ̵å) ¾Û °³¹ß ±âÃÊ] MEDIAPLAYER À½¾Ç Àç»ýÇϱâ
1,192
[Android]MediaPlayer¿¡¼­ »ç¿îµå¸¦ Àç»ýÇÏ´Â µÎ °¡Áö °æ·Î
1,191
¾Èµå·ÎÀ̵å Intent »ç¿ë¹ý
1,190
¾Èµå·ÎÀ̵å È­¸é Á¤¸®
1,189
ffmpeg ¿ÀÇ ¼Ò½º on ¾Èµå·ÎÀ̵å
1,188
WebView¿¡¼­ <a> ű×ÀÇ "_blank" target ó¸®Çϱâ.
1,187
Ư¼ö¹®ÀÚ, Ư¼ö¹®ÀÚÇ¥, Ư¼ö¹®ÀÚ ÇÏÆ®, ¿¹»Û Ư¼ö¹®ÀÚ
1,186
MediaPlayer 5¹ø¸¸ ¹Ýº¹Àç»ý
1,185
ÆÄÀÏ À§Ä¡¿¡ µû¸¥ ¹Ìµð¾î Àç»ý »ùÇÃÄÚµå
1,184
MJPEG on Android anyone?
1,183
Android °³¹ß
1,182
¾Èµå·ÎÀ̵å : ¾×ƼºñƼ ¶óÀÌÇÁ »çÀÌŬ (Activity Life Cycle)
1,181
¾Èµå·ÎÀ̵å ÇÁ·Î±×·¥ ÄÚµå·Î À¥ ºê¶ó¿ìÀú ½ÇÇàÇϱ⠿¹Á¦ (ÀÎÅÙÆ® »ç¿ë)
1,180
Áøµ¿ È¿°ú [Android]
1,179
Á¾·á ´ÙÀ̾ó·Î±× [Android]
1,178
´Ù¸¥¾Û È£Ãâ [Android]
1,177
TabActivity back key Event [Android]
1,176
³×Æ®¿öÅ© »óÅ [Android]
1,175
¾Èµå·ÎÀ̵忡¼­ À¥¼­¹ö¿¡ post·Î ±Û¾²±â [Android]
1,174
Webview ¼Ò½º [Android]
1,173
Coach mark View [Android]
1,172
¸ÖƼ ÇØ»óµµ [Android]
1,171
Webview source [Android]
1,170
°øÀ¯ Intent [Android]
1,169
intent uri ¸ðÀ½ [Android]
1,168
http post [Android]
1,167
http ¿äû [Android]
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.