|
|
| |
|
|
7³â Àü |
¾Èµå·ÎÀ̵å 4.4¿¡¼ »ç¿ëÇÏ´Â WebView´Â Chromium ±â¹ÝÀ¸·Î º¯°æµÊ¿¡ µû¶ó ¾Èµå·ÎÀ̵å Å©·Ò ºê¶ó¿ìÀú¿Í µ¿ÀÏÇÑ ¼öÁØÀÇ ¼º´É°ú È£¿Ï¼ºÀ» °®Ãß°í ÃֽŠHTML5, CSS3 Ç¥ÁØ ±â¼úµéÀ» Áö¿øÇϸç V8 ÀÚ¹Ù½ºÅ©¸³Æ® ¿£ÁøÀÌ Å¾ÀçµÈ ÃֽŹöÀüÀ¸·Î Àû¿ëµÇ¾ú½À´Ï´Ù.
ÀÌÁ¦ºÎÅÍ º»°ÝÀûÀ¸·Î ¼³¸íÇÒ °ÍµéÀº ¸Å´ÏÆ佺Ʈ¿¡ targetSdkVersionÀ» 19ÀÌ»óÀ¸·Î ¼³Á¤ÇÒ °æ¿ì ¾Ë¾Æ¾ß ÇÒ WebView º¯°æ»çÇ׵鿡 ´ëÇÑ ¼³¸íÀÔ´Ï´Ù.
targetSdkVersionÀÌ 18¶Ç´Â À̺¸´Ù ³·Àº °æ¿ì À¥ºä´Â quirks mode¶ó´Â ȣȯ ¸ðµå·Î µ¿ÀÛÇϵµ·Ï ±¸ÇöµÇ¾î ÀÖ½À´Ï´Ù. ±×·¯³ª 4.4ÀÇ È£È¯¸ðµå¿¡¼µµ single and narrow column layouts ¹× default zoom levelsÀº Áö¿øÇÏÁö ¾ÊÀ¸¸ç ÀÌ¿Ü¿¡µµ ¾ÆÁ÷ ¾Ë·ÁÁöÁö ¾ÊÀº ¹®Á¦°¡ ¹ßÇàÇÒ ¼ö ÀÖÀ¸´Ï ¾Èµå·ÎÀ̵å 4.4 À̻󿡼 ²À Å×½ºÆ®ÇؾßÇÕ´Ï´Ù.
4.4 À¥ºä ÃÖÀûÈ ÀÛ¾÷Áß ÀÏ¾î³ À̽´¿¡ ´ëÇØ µµ¿òÀ» ÁÖ±â À§ÇØsetWebContentsDebuggingEnabled()À» ÀÌ¿ëÇÑ µ¥½ºÅ©·Ó Å©·ÒÀ» ÅëÇÑ ¿ø°Ý µð¹ö±ëÀÌ °¡´ÉÇØÁ³½À³ª´Ù. ÀÌ ±â´ÉÀ» ÅëÇØ WebView¸¦ ½ÇÇàÇÏ´Â µ¿¾È À¥ ÄÁÅÙÃ÷, ½ºÅ©¸³Æ® ¹× ³×Æ®¿öÅ© È°µ¿À» °Ë»çÇÏ°í ºÐ¼® ÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº Debugging on AndroidÀ» ÂüÁ¶Çϼ¼¿ä.
User Agent Changes
À¯Àú ¿¡ÀÌÀüÆ®¸¦ ÅëÇØ À¥ºä¿¡ ¸ÂÃãÇü ÄÁÅÙÃ÷¸¦ Á¦°øÇÏ´Â °æ¿ì°¡ ÀÖÀ» °ÍÀÔ´Ï´Ù. 4.4¿¡¼´Â ±âÁ¸ À¯Àú ¿¡ÀÌÀüÆ® ÇüÅ¿ʹ ´Þ¸® Å©·Ò ¹öÀüÀ» Æ÷ÇÔÇÏ°Ô µÇ¾ú½À´Ï´Ù.
Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36
(KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
¸¸¾à À¯Àú ¿¡ÀÌÀüÆ®¸¦ º¸±â¸¸ ÇÏ°í ÀúÀåÇÏ°í ½ÍÁö ¾Ê´Ù¸é ½ºÅÂƽ ¸Þ¼µåÀÎgetDefaultUserAgent()À» »ç¿ëÇÏ¸é µË´Ï´Ù.
public static String getDefaultUserAgent (Context context)
Added in API level 17
Returns the default User-Agent used by a WebView. An instance of WebView could use a different User-Agent if a call is made to setUserAgentString(String).
±×·¯³ª ´ë½Å À¥ºä°´Ã¼ »ý¼º ÈÄ setUserAgentString()À» ÀÌ¿ëÇÑ Ä¿½ºÅÒ ¿¡ÀÌÀüÆ® Àû¿ë½Ã¿¡´Â getUserAgentString()À» »ç¿ëÇؾßÇÕ´Ï´Ù.
public synchronized String getUserAgentString ()
Added in API level 3
Gets the WebView¡¯s user-agent string.
Returns
the WebView¡¯s user-agent string
Multi-threading and Thread Blocking
UI ¾²·¹µå°¡ ¾Æ´Ñ º°µµÀÇ ¾²·¹µå¿¡¼ WebView¸¦ È£ÃâÇÑ´Ù¸é ¿¹ÃøÇÏÁö ¸øÇÑ °á°ú°¡ »ý±æ ¼öµµ ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î¼ ¾Û¿¡¼ ¸ÖƼ ¾²·¹µå¸¦ »ç¿ëÇÒ °æ¿ì À¥ºä¸¦ UI¿¡¼ »ç¿ëÇϱâ À§ÇØ ¾Æ·¡¿Í °°ÀÌ runOnUiThread()¸¦ ÅëÇØ È£ÃâµÇ¾î¾ß ÇÕ´Ï´Ù.
runOnUiThread(new Runnable() {
@Override
public void run() {
// Code for WebView goes here
}
});
¶ÇÇÑ UI ¾²·¹µå¸¦ Â÷´ÜÇϸé ÀÚ¹Ù½ºÅ©¸³Æ®¿ÍÀÇ ¿¬µ¿¿¡ ¹®Á¦°¡ »ý±æ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦µé¾î ¾Æ·¡ ÄÚµåó·³ »ç¿ëÇÏ¸é ¾ÈµË´Ï´Ù.
// This code is BAD and will block the UI thread
webView.loadUrl(¡°javascript:fn()¡±);
while(result == null) {
Thread.sleep(100);
}
±× ´ë½Å ºñµ¿±â·Î ÀÚ¹Ù ½ºÅ©¸³Æ®¸¦ ½ÇÇàÇÒ ¼ö ÀÖ°Ô ÇØÁÖ´ÂevaluateJavascript()¸¦ »ç¿ë ÇÒ ¼ö ÀÖ½À´Ï´Ù.
public void evaluateJavascript (String script, ValueCallback<String> resultCallback)
Added in API level 19
Asynchronously evaluates JavaScript in the context of the currently displayed page. If non-null, |resultCallback| will be invoked with any result returned from that execution. This method must be called on the UI thread and the callback will be made on the UI thread.
Parametersscriptthe JavaScript to execute.resultCallbackA callback to be invoked when the script execution completes with the result of the execution (if any). May be null if no notificaion of the result is required.
Custom URL Handling
ÀÌÁ¦ À¥ºä¸¦ »ç¿ëÇÒ ¶§ ¿ÀÁ÷ À¯È¿ÇÑ URL¿¡ ´ëÇؼ¸¸shouldOverrideUrlLoading() ¶Ç´Â shouldInterceptRequest()°¡ È£Ã⠵ǾîÁý´Ï´Ù.
4.4 ¿¡¼ Ä¿½ºÅÒ URL ½ºÅ´ ¶Ç´Â base URLÀ» »ç¿ëÇÏ¿© ¸®¼Ò½ºµéÀ» ºÒ·¯¿Ã¶§ ½ÇÆÐÇϰųª Àß ÀÛµ¿ÇÏÁö ¾Ê´Â´Ù¸é RFC 3986À» ÁؼöÇÏ´Â À¯È¿ÇÑ URLÀ» ÁöÁ¤Çß´ÂÁö¸¦ È®ÀÎÇϼ¼¿ä.
¿¹¸¦ µé¾î¼ »õ·Î¿î À¥ºä¿¡¼´Â ¾Æ·¡¿Í °°Àº ¸µÅ©¿¡ ´ëÇؼ´ÂshouldOverrideUrlLoading()´Â È£ÃâµÇÁö ¾ÊÀ» °ÍÀÔ´Ï´Ù.
<a href=¡±showProfile¡±>Show Profile</a>
¾Æ·¡ÀÇ °æ¿ì À¯Àú°¡ ¸µÅ©¸¦ Ŭ¸¯ÇÒ¶§ »óȲ¿¡ µû¶ó °á°ú´Â ´Þ¶óÁú ¼ö ÀÖ½À´Ï´Ù :
¸¸¾à URLÀ» nullÀ̳ª Çü½Ä¿¡ ¸ÂÁö¾Ê´Â °ªÀ¸·Î loadData()³ªloadDataWithBaseURL()À» È£ÃâÇÒ °æ¿ì shouldOverrideUrlLoading()°¡ È£ÃâµÇÁö ¾Ê½À´Ï´Ù.
loadUrl()À̳ª loadDataWithBaseURL()À» ÅëÇØ À¯È¿ÇÑ URLÀ» È£ÃâÇÏ´Â °æ¿ì¿¡´Â shouldOverrideUrlLoading()°¡ È£ÃâµË´Ï´Ù. ±×·¯³ª ÀÌ °æ¿ì¿¡´Â ½ÇÁ¦ URLÁÖ¼Ò¸¦ Àü´Þ ¹Þ½À´Ï´Ù. Áï, showProfile ´ë½Å¿¡http://www.example.com/showProfileÀ» Àü´Þ ¹ÞÀ» °ÍÀÔ´Ï´Ù.
À§¿Í °°ÀÌ »ç¿ëÇÏ·Á¸é ÀÌÁ¦´Â ¾Æ·¡¿Í °°ÀÌ ½ºÅ´À» ÀÌ¿ëÇÏ¸é µË´Ï´Ù.
<a href=¡±example-app:showProfile¡±>Show Profile</a>
À̸¦ ÅëÇØ shouldOverrideUrlLoading()ÀÌ È£ÃâµÇ¸é ¾Æ·¡ ÇÔ¼ö¿Í °°ÀÌ URLÀ» »ç¿ëÇÏ¸é µË´Ï´Ù.
private static final String APP_SCHEME = ¡°example-app:¡±;
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith(APP_SCHEME)) {
urlData = URLDecoder.decode(url.substring(APP_SCHEME.length()), ¡°UTF-8");
respondToData(urlData);
return true;
}
return false;
}
HTMLÀ» º¯°æÇÒ ¼ö ¾ø´Â °æ¿ì¿¡´Â loadDataWithBaseURL ()À» ÅëÇØ ÀÌ·±½ÄÀÇ — ¡°example-app://<valid_host_name>/¡±- Ä¿½ºÅÒ ½ºÅ´À¸·Î ±¸¼ºµÈ ±âº» URL°ú À¯È¿ÇÑ È£½ºÆ®¸¦ ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¸é ¾Æ·¡¿Í °°½À´Ï´Ù.
webView.loadDataWithBaseURL(¡°example-app://example.co.uk/¡±, HTML_DATA, null, ¡°UTF-8", null);
À¯È¿ÇÑ È£½ºÆ® À̸§Àº RFC 3986À» ÁؼöÇؾßÇÏ¸ç ³¡¿¡ ½½·¡½Ã¸¦ Æ÷ÇÔÇÏ´Â °ÍÀÌ Áß¿äÇÕ´Ï´Ù, ±×·¸Áö ¾ÊÀ¸¸é ·Îµå µÈ ÆäÀÌÁö¿¡¼ ¸ðµç ¿äûÀº µå·ÓµÉ ¼ö ÀÖ½À´Ï´Ù.
Viewport Changes
ºä Æ÷Æ®¶õ ¸ÖƼ µð¹ÙÀ̽ºµéÀÇ Çػ󵵿¡ ´ëÀÀÇϱâ À§ÇØ »ç¿ëµÇ´Â ű׸¦ ¸»ÇÕ´Ï´Ù.
target-densitydpi¸¦ ´õ ÀÌ»ó Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.
target-densitydpiÀÇ °æ¿ì ¾ÆÀÌÆù¿¡¼´Â Áö¿øÇÏÁö ¾ÊÀ¸¹Ç·Î °øÅëÀ¸·Î ó¸®ÇÒ ¼ö ÀÖ´Â ±âÁØÀ» Áö¿øÇϱâ À§ÇØ Áö¿øÇÏÁö ¾Êµµ·Ï ÇÏ´Â°Í °°½À´Ï´Ù.
ÀÌÀü¹öÀüÀÇ °æ¿ì À¥ºä¿¡¼ À¥ÆäÀÌÁöÀÇ ½ºÅ©¸° density¸¦ ÁöÁ¤Çϴµ¥ »ç¿ëÇÏ´Â target-densitydpiÀ̶ó´Â ºäÆ÷Æ® ¼Ó¼ºÀÌ ÀÖ¾ú½À´Ï´Ù.
<meta name=¡±viewport¡± content=¡±target-densityDpi=device-dpi¡±>
ÀÌ ¼Ó¼ºÀº ´õ ÀÌ»ó Áö¿øµÇÁö ¾ÊÀ¸¸ç À̹ÌÁö³ª CSS¿¡ ´ëÇØ Pixel-Perfect UI in the WebView¿¡¼ º¼ ¼ö Àִ ǥÁعæ¹ýÀ¸·Î ¸¶À̱׷¹ÀÌ¼Ç ÇؾßÇÒ °ÍÀÔ´Ï´Ù.
Viewport zooms in when small
ÀÌÀü¿¡ ºäÆ÷Æ®ÀÇ ³ÐÀÌ°¡ 320À̰ųª ±×º¸´Ù ÀÛ¾Ò´Ù¸é ³ÐÀÌ °ªÀº device-width·Î, ³ôÀÌ°¡ À¥ºäÀÇ ³ôÀ̺¸´Ù À۰ųª °°À»°æ¿ì´Â device-height·Î ¼³Á¤µÇ¾úÀ» °ÍÀÔ´Ï´Ù. ±×·¯³ª »õ·Î¿î À¥ºä¿¡¼´Â ³ÐÀÌ ¶Ç´Â ³ôÀÌ °ªÀÌ °ªÀÌ ÁؼöµÇ¸ç ½ºÅ©¸°ÀÇ ³ÐÀÌ¿¡ ¸Â°Ô À¥ºä°¡ ÁÜ µÉ °ÍÀÔ´Ï´Ù.
<meta name=¡±viewport¡± content=¡±width=device-width, height=device-height¡±>
Multiple viewport tags not supported
4.4 ÀÌÀü¹öÀü¿¡¼´Â ¿©·¯°³ÀÇ ºäÆ÷Æ® ¸ÞŸÅ±׸¦ ¼±¾ðÇϸé, ÀÚµ¿À¸·Î ±×°ÍµéÀÌ °áÇÕµÇ¾î »ç¿ëµÇ¾úÁö¸¸, À̹ø ¹öÀüÀÇ À¥ºä¿¡¼´Â ¸¶Áö¸·¿¡ ¼±¾ðµÈ À¥ºä¸¸ »ç¿ëµÇ°í ³ª¸ÓÁö´Â ¹«½ÃµË´Ï´Ù.
Default zoom is deprecated
getDefaultZoom() °ú setDefaultZoom() °¡ ´õ ÀÌ»ó Áö¿ø µÇÁö¾Ê½À´Ï´Ù.
WebView¿¡¼ ÀÚµ¿À¸·Î default zoomÀ» ¸ÂÃçÁֱ⠶§¹®
ÀÌ Àû¿ë»çÇ×Àº 4.4 ¹× ±× ÀÌ»óÀÇ ¹öÀü »Ó¸¸¾Æ´Ï¶ó targetSdkVersionÀ» 18À̳ª ±× ÀÌÇÏ·Î ¼³Á¤ÇÒ °æ¿ì¿¡µµ µ¿ÀÛÇÏÁö ¾Ê½À´Ï´Ù.
¸¸¾à ºäÆ÷Æ®ÀÇ ³ÐÀ̸¦ ÁöÁ¤ÇÏÁö ¾Ê¾Ò´Ù¸é ¾Æ·¡¿Í °°ÀÌ setUseWideViewPort()ÇÔ¼ö¸¦ ÅëÇؼ ´õ Å« ºäÆ÷Æ®¸¦ ÇÒ´ç ¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.
public synchronized void setUseWideViewPort (boolean use)
Added in API level 1
Sets whether the WebView should enable support for the ¡°viewport¡± HTML meta tag or should use a wide viewport. When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used.
Parametersusewhether to enable support for the viewport meta tag
WebSettings settings = webView.getSettings();
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
Styling Changes
The background CSS shorthand overrides background-size
À̹ø À¥ºä´Â ¹è°æ ½ºÅ¸ÀÏÀ» ÁöÁ¤ÇÏ´Â °æ¿ì background-size¸¦ À§ÇÑ CSS ¼¼ÆÃÀ» ÀçÁ¤ÀÇÇÕ´Ï´Ù. ¿¹¸¦ µé¾î, ¾Æ·¡ÀÇ background-size´Â ±âº»°ªÀ¸·Î º¯°æµÉ °ÍÀÔ´Ï´Ù.
.some-class {
background-size: contain;
background: url(¡®images/image.png¡¯) no-repeat;
}
// µÎ ¼Ó¼ºÀÇ °£ÀÇ À§Ä¡°¡ º¯°æµÇ¾ú½À´Ï´Ù.
.some-class {
background: url(¡®images/image.png¡¯) no-repeat;
background-size: contain;
}
Sizes are in CSS pixels instead of screen pixels
ÀÌÀü¿¡´Â window.outerWidth À̳ª window.outerHeight¸¦ ÅëÇØ ½ÇÁ¦ ½ºÅ©¸° Çȼ¿ °ªÀ» ¹Þ¾ÒÁö¸¸ »õ·Î¿î À¥ºäÀÇ °æ¿ì´Â CSSÇȼ¿ ±â¹ÝÀÇ °ªÀ» ¹Þ½À´Ï´Ù.
½ºÅ©¸°»çÀÌÁ ±¸ÇÒ¶§ ÀÌÀü ¹öÀü¿¡¼´Â window.outerWIdth / outerHeight ¸¦ ÅëÇØ ±¸ÇÒ ¼ö ÀÖ¾úÁö¸¸ 4.4¿¡¼´Â<br />outerWidth/Height°¡ css pixelÀ» ³ªÅ¸³»°Ô µË´Ï´Ù.
ÀÌ·¸°Ô ½ÇÁ¦ ½ºÅ©¸° Çȼ¿ °ªÀ» ¹Þ¾Æ °è»êÇÏ¿© »ç¿ëÇÏ´Â °ÍÀº ³ª»Û ¹æ¹ýÀÔ´Ï´Ù. ÀÌÁ¦´Â °è»êÀÛ¾÷ÀÌ ÇÊ¿ä¾øÀÌ JavaScript binding¸¦ ÀÌ¿ëÇÏ¿© À¥ºäÀÇ ½ÇÁ¦ Çȼ¿°ªÀ» °¡Á®¿Ã ¼ö ÀÖ½À´Ï´Ù.
ex) ½ÇÁ¦ µð¹ÙÀ̽º Width : 480 | window.outterWidth : 288
´õ ÀÚ¼¼ÇÑ ³»¿ëÀº quirksmode.orgÀ» ÂüÁ¶ÇØÁÖ¼¼¿ä.
NARROW_COLUMNS and SINGLE_COLUMN no longer supported
»õ·Î¿î À¥ºä¿¡¼´Â WebSettings.LayoutAlgorithm¸¦ À§ÇÑNARROW_COLUMNS °ªÀ» ´õÀÌ»ó Áö¿øµÇÁö ¾Ê½À´Ï´Ù.
ÀÌ Àû¿ë»çÇ×Àº 4.4 ¹× ±× ÀÌ»óÀÇ ¹öÀü »Ó¸¸¾Æ´Ï¶ó targetSdkVersionÀ» 18À̳ª ±× ÀÌÇÏ·Î ¼³Á¤ÇÒ °æ¿ì¿¡µµ µ¿ÀÛÇÏÁö ¾Ê½À´Ï´Ù.
´ÙÀ½°ú °°Àº ¹æ¹ýÀ¸·Î ÀÌ·¯ÇÑ º¯È¸¦ ó¸®ÇÒ ¼ö ÀÖ½À´Ï´Ù.
½ºÅ¸ÀÏÀ» º¯°æ :
HTML ¶Ç´Â CSS¸¦ »ç¿ëÇÏ°í ÀÖ´Ù¸é ½Å·ÚÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀ» »ç¿ëÇؾßÇÕ´Ï´Ù. ¿¹¸¦ µé¾î ½ÎÀÌÆ®¿¡¼ ¶óÀ̼¾½º¸¦ Ç¥ÇöÇÒ¶§´Â <pre>¾È¿¡ ÅؽºÆ®¸¦ ³Ö±æ ¿øÇÒ °ÍÀÔ´Ï´Ù. ±×·²°æ¿ì ´ÙÀ½°ú °°ÀÌ ÁöÁ¤ÇÏ¸é µË´Ï´Ù.
<pre style=¡±word-wrap: break-word; white-space: pre-wrap;¡±>
ÀÌ°ÍÀº ÆäÀÌÁö¿¡ ´ëÇÑ ºäÆ÷Æ® ¼Ó¼ºÀ» Á¤ÀÇÇÏÁö ¾ÊÀº °æ¿ì ƯÈ÷ µµ¿òÀÌ µË´Ï´Ù.
»õ·Î¿î TEXT_AUTOSIZING layout algorithm »ç¿ë :
´Ù¾çÇÑ ±â±â¸¦ Áö¿øÇϱâ À§ÇØ narrow columnsÀ» »ç¿ëÇÏ°í ÀÖ¾ú´Ù¸é HTML ÄÁÅÙÃ÷¿¡ ´ëÇØ ¼öÁ¤À» ÇÒ ¼ö ¾ø½À´Ï´Ù. »õ·Î¿î TEXT_AUTOSIZING layout algorithmÀº ÀÌ°Í¿¡ ´ëÇÑ ÀûÀýÇÑ ´ë¾ÈÀÌ µÉ ¼ö ÀÖ½À´Ï´Ù.
¶ÇÇÑ À̹ø ¹öÀü¿¡¼´Â ÀÌÀü¿¡ deprecatedµÈ SINGLE_COLUMNµµ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.
À¥ºä ÀÚü¿¡¼ ºäÆ÷Æ®¸¦ °ü¸®ÇÏ°Ô µÈ ¸¸Å, ÀÌÀü ¹öÀü¿¡¼ ·¹À̾ƿôÀ̳ª ºäÆ÷Æ®¿¡´ëÇØ ¿É¼ÇÀ¸·Î Á¦°øÇÏ´ø method ³ª ¼Ó¼ºµéÀ» ¸ðµÎ Á¦°Å
Handling Touch Events in JavaScript
À¥ ÆäÀÌÁö¿¡ Á÷Á¢ WebView ÅÍÄ¡ À̺¥Æ®¸¦ ó¸®ÇÏ´Â °æ¿ì, touchcancel À̺¥Æ®¸¦ ó¸®ÇÏ°í ÀÖ´ÂÁö È®ÀÎÇϼ¼¿ä. ¾Æ·¡¿¡´Â touchcancel¸¦ È£ÃâÇßÀ»¶§ ¼ö½ÅÇÏÁö ¾ÊÀ» °æ¿ì ¾î¶² ¹®Á¦°¡ ¹ß»ýÇÒ ¼ö ÀÖ´Â ½Ã³ª¸®¿À°¡ ÀÖ½À´Ï´Ù.
ȸéÀ» ÅÍÄ¡ÇÏ°í(touchstart ¿Í touchmove°¡ ºÒ¸²) ÆäÀÌÁö¸¦ ½ºÅ©·Ñ ÇßÀ»¶§ touchcancel°¡ ¹ß»ýÇÕ´Ï´Ù.
ȸéÀ» ÅÍÄ¡ÇßÁö¸¸(touchstart°¡ ºÒ¸²) event.preventDefault()°¡ ¾È ºÒ¸°°æ¿ì(À¥ºä¿¡¼ ÅÍÄ¡À̺¥Æ®¸¦ »ç¿ë´Â °ÍÀ» ¿øÇÏÁö ¾Ê´Â´Ù´Â°ÍÀ» °¡Á¤) ÀÌÀü¿¡ touchcancel À̺¥Æ®¸¦ ¹ÞÀ» °ÍÀÔ´Ï´Ù.
event.preventDefault()¶õ?
// ¾Æ·¡¿Í °°ÀÌ ÀÛ¼ºÇÑ °æ¿ì if¿¡ Á¶°Ç¿¡ ¸Â´Â Å°ÄÚµåÀÇ °æ¿ì´Â À̺¥Æ®°¡ ¹ß»ýÇÏÁö ¾Êµµ·Ï ÇÏ´Â ¿ªÇÒÀ» ÇÑ´Ù. function keyeventtest(event){ if( event.keyCode == ¡®¡¯ ){ alert(¡®Test¡¯); event.preventDefault(); } } |
|
̵̧ : 974 |
̵̧
¸ñ·Ï
|
|
| |
|