哈姆尔的iframe src

Mar*_*ina 2 ruby haml ruby-on-rails

使用iframe时,我总是得到一个空白页面.我在src中放置了包含代码的Haml文件的位置以创建复选框:

view.haml:

%iframe{:src => "file:///home/marina/project/app/views/blog_posts/new2.haml"}
Run Code Online (Sandbox Code Playgroud)

new2.haml:

%h1 popup
br
%input{:name => "option1", :type => "checkbox", :value => "Milk"}
Milk
%br
%input{:name => "option2", :type => "checkbox", :value => "Butter"}
Butter
%br
%input{:name => "option3", :type => "checkbox", :value => "Cheese"}
Cheese
%br
Run Code Online (Sandbox Code Playgroud)

Vik*_*Vik 5

试试:

如果文件在同一个地方

%iframe{:src => "blog_posts/new2.haml"}
Run Code Online (Sandbox Code Playgroud)

否则建议将其用作:

为new2操作制作路线,并通过网址调用iframe,如:

%iframe{:src => "http://yourdomain.com/new2"}
Run Code Online (Sandbox Code Playgroud)