我确实读过每个stackoverflow线程关于在IE9中通过javascript动态更改视频标记源,包括有用但未商定的帖子在这里和这里,但确实感觉有另一个解决方案.这是我正在尝试做的非常基本的例子:
var video = document.getElementById('video');
//now, use either of the lines of code below to change source dynamically
video.src = "nameOfVideo";
//or use...
video.setAttribute("src", "nameOfVideo");
Run Code Online (Sandbox Code Playgroud)
这两行代码都被Internet Explorer彻底憎恨,特别是因为在使用简单的video.getAttribute进行检查后,src肯定会被更改,即使IE实际上没有做任何事情来切换视频.
是的,有人声称,使用IE,你必须在HTML中列出src,以便在页面加载后更改它们,但我确实在stackoverflow上找到了一个通过简单的JavaScript提出解决方案的线程.(令我失望的是,我再也找不到这样做的话......我到处搜寻,相信我).
尽管如此,如果有人能提供解决方案而不使用将所有视频src放在HTML中,而是使用JavaScript动态设置/创建src,如上所示,我将非常感激.
(或者,如果你可以指向我'缺少'溢出线程的方向,测试该属性是否存在于IE中,然后以某种方式通过javascript设置src,这也将被赞赏).
这个问题让我感到害怕,我觉得我已经尝试了一切.
首先,升级到Capistrano 3时问题就开始了.Capistrano现在在部署之前在每个命令之前使用/ usr/bin/env,以确保环境设置正确.
当Capistrano创建符号链接到必要的共享目录和相应文件时,它会尝试以下命令:
/usr/bin/env ln -s /full/path /different/full/path
Run Code Online (Sandbox Code Playgroud)
......然后它出错了:
/usr/bin/env: ln: Too many levels of symbolic links
Run Code Online (Sandbox Code Playgroud)
我意识到这不是Capistrano的错,所以我开始通过ssh'ing到我的服务器进行故障排除并尝试相同的命令,并且我收到相同的错误(至少有利于一致性).然后我在没有/ usr/bin/env的情况下尝试相同的命令:
ln -s /full/path /different/full/path
Run Code Online (Sandbox Code Playgroud)
它的工作原理!!!! 也许你可以看到我不能的真正解决方案?
这里只是/ usr/bin/env命令的输出:
rvm_bin_path=/home/deployer/.rvm/bin
GEM_HOME=/home/deployer/.rvm/gems/ruby-1.9.3-p392
TERM=xterm-256color
SHELL=/bin/bash
IRBRC=/home/deployer/.rvm/rubies/ruby-1.9.3-p392/.irbrc
SSH_CLIENT=...
OLDPWD=/home/deployer/Sites/example.com
MY_RUBY_HOME=/home/deployer/.rvm/rubies/ruby-1.9.3-p392
SSH_TTY=/dev/pts/0
USER=deployer
LS_COLORS= .....
_system_type=Linux
rvm_path=/home/deployer/.rvm
SSH_AUTH_SOCK=....
rvm_prefix=/home/deployer
MAIL=/var/mail/deployer
PATH=/home/deployer/.rvm/gems/ruby-1.9.3-p392/bin:/home/deployer/.rvm/gems/ruby-1.9.3-p392@global/bin:/home/deployer/.rvm/rubies/ruby-1.9.3-p392/bin:/home/deployer/.rvm/bin:/opt/rubyee/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/deployer/.rvm/bin
PWD=/home/deployer/Sites
LANG=en_US.UTF-8
_system_arch=i386
_system_version=12.04
rvm_version=1.26.4 (latest)
SHLVL=1
HOME=/home/deployer
LOGNAME=deployer
GEM_PATH=/home/deployer/.rvm/gems/ruby-1.9.3-p392:/home/deployer/.rvm/gems/ruby-1.9.3-p392@global
SSH_CONNECTION=....
LESSOPEN=| /usr/bin/lesspipe %s
LESSCLOSE=/usr/bin/lesspipe %s %s
RUBY_VERSION=ruby-1.9.3-p392
_system_name=Ubuntu
_=/usr/bin/env
Run Code Online (Sandbox Code Playgroud)
我还尝试了以下命令,以找到潜在的符号链接循环:
find . -maxdepth 20 -type l -exec ls -ld {} +
Run Code Online (Sandbox Code Playgroud)
但是没有产生正确的结果: …
显然我在下面的例子中忽略了一些非常简单的事情,我试图在实例化新的父记录时创建嵌套的关联记录.
我希望有一双新鲜的眼睛,我的帮助可以找到几天来一直在吃的东西.提前致谢!我错过了什么/弄乱了什么?这似乎是微不足道的.
ActiveRecord :: NestedAttributes显然不高兴.
class ContentGroup < ActiveRecord::Base
attr_protected
has_many :contents, :dependent=>:destroy
accepts_nested_attributes_for :contents
end
Run Code Online (Sandbox Code Playgroud)
class Content < ActiveRecord::Base
attr_protected
has_one :sort_item, :as=>:sortable
belongs_to :content_group, :dependent=>:destroy
accepts_nested_attributes_for :sort_item
end
Run Code Online (Sandbox Code Playgroud)
class SortItem < ActiveRecord::Base
attr_accessible :position, :sortable_id, :sortable_type
belongs_to :sortable, :polymorphic=>true
end
Run Code Online (Sandbox Code Playgroud)
> p = {"sort_item_attributes"=>{"position"=>"1"}}
> b = Content.new(p)
=> Content id: nil, content_group_id: nil
Run Code Online (Sandbox Code Playgroud)
> p = {"contents_attributes"=>{"sort_item_attributes"=>{"position"=>"1"}}}
> cg = ContentGroup.new(p)
ActiveRecord::UnknownAttributeError: unknown attribute: position
from /.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record/attribute_assignment.rb:88:in `block in assign_attributes'
from /.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record/attribute_assignment.rb:78:in `each'
from /.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record/attribute_assignment.rb:78:in …Run Code Online (Sandbox Code Playgroud) activerecord ×1
associations ×1
bash ×1
capistrano3 ×1
html5-video ×1
javascript ×1
ruby ×1
rvm ×1
setattribute ×1
ubuntu-12.04 ×1