Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3515] Cannot disable scroll in webview containing embeded YouTube video

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionHold
Resolution Date2011-06-23T13:48:25.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-25
ComponentsiOS
Labelsdefect, ios, ipad, klist, rplist, scrolling, webview
ReporterAlan Leard
AssigneeSabil Rahim
Created2011-04-15T03:46:10.000+0000
Updated2017-03-07T18:04:57.000+0000

Description

Problem

When embedding a YouTube video there is no way to disable scrolling within the webview.

Test Code

Adding this to your html should disable scrolling, and does unless the html content is the embed code from YouTube:

<html>
<head>
<script type="text/javascript">document.addEventListener("touchmove", touchHandler, false);function touchHandler(e) { if(e.touches.length == 1) { e.preventDefault(); } }</script>
<style type="text/css">div#test { background: #ca0000; height: 495px; width: 680px; }</style>
</head>

Here is complete testing code:

var win = Titanium.UI.createWindow();

var default_video_html = '<html><head>
<script type="text/javascript">document.addEventListener("touchmove", touchHandler, false);function touchHandler(e) { if(e.touches.length == 1) { e.preventDefault(); } }</script>
<style type="text/css">div#test { background: #ca0000; height: 495px; width: 680px; }</style>
</head><body><object width="680" height="495" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="http://www.youtube.com/v/[videoid]&amp;autoplay=1" name="movie"><param value="transparent" name="wmode"><param value="true" name="allowfullscreen"><embed width="680" height="495" allowfullscreen="true" wmode="transparent" type="application/x-shockwave-flash" src="http://www.youtube.com/v/b661ovU1rPU&;amp;autoplay=1"></object></body></html>';

var web_videobox = Ti.UI.createWebView({
    height: 510,
    width: 690,
    backgroundColor:'#000000',
    html: default_video_html
});

win.add(web_videobox);
win.open();

Replace the youtube object with any other html and you will see that scrolling is disabled.

May need to be tested on device. Specifically iPad

Ticket Reference

http://support-admin.appcelerator.com/display/EMP-64323-566">http://support-admin.appcelerator.com/display/EMP-64323-566

Comments

  1. Sabil Rahim 2011-06-23

    This is an Apple UIWebView bug. This can be seen by checking the same html code in Safari and it would show the same behavior. The scroll on the webview itself is being disabled, only the scroll on youtube video cannot be disabled.
  2. Lee Morris 2017-03-07

    Closing ticket due to time passed.

JSON Source