2013-12-12 1 views
0

나는 다음과 같은 iframe을 사용하여 레일 4 응용 프로그램에서 비디오를 포함하는 것을 시도하고있다 : 내 로컬 서버에서 응용 프로그램을 제공하고 지금방지 레일의 src URL의 4 변환

<iframe src ="http://www.slideshare.net/slideshow/embed_code/4482208"> </iframe> 

을 (로컬 호스트 : 3000) .

응용, 그러나, 자동으로

http://localhost:3000/www.slideshare.net/slideshow/embed_code/4482208 

나는이 상상에서 비디오를 찾습니다 때문에 레일 자산 파이프 라인이다?

내 로컬 서버가 아닌 slideshare.net에서 외부 위치에서 비디오를 찾으려면 앱이 필요합니다.

Backbone 프런트 엔드 내에서 jquery를 사용하여 iframe을 dom 객체로 삽입합니다. 여기 코드입니다 :

x = $(document.createElement('iframe')).attr({src: "http://www.slideshare.net/slideshow/embed_code/2686843" , frameborder: '0', marginwidth: '0', marginheight: '0', scrolling: 'no', allowfullscreen: ''}) 

$('body').append x 
+0

이 URL을 생성하는'link_to'를 사용하는 ? 일부 코드를 볼 수 있습니까 – CuriousMind

+0

'link_to'를 사용하고 있지 않습니다. 간단히 dom iframe 객체를 생성하고 (백본 프론트 엔드 내에서 jquery를 사용하여) 삽입합니다. x = $ (document.createElement ('iframe')). addClass ('slideshare'). attr ({src : "http://www.slideshare.net/slideshow/embed_code/2686843", frameborder : '0 ', marginwidth :'0 ', marginheight :'0 ', 스크롤 :'no ', allowfullscreen :' '} – user1050268

+0

코드를 보여줍니다. – CuriousMind

답변

0

이 시도 :이 작동하는 경우

<script type='text/javascript'> 
window.onload = function() { 
    var iframe = document.createElement('iframe'); 
    iframe.style.display = "none"; 
    iframe.src = "http://www.slideshare.net/slideshow/embed_code/4482208"; 
    document.body.appendChild(iframe); 
}; 
</script> 

, 당신은, frameborder 같은 다른 속성을 추가 할 수 있습니다 marginwidth

관련 문제