javascript - Why doesn't setting frame src by js show the display source? -


based on js condition, want either of 2 things happen;

  1. either show frame on page or
  2. show link "show pdf" on page.. show pdf

now while know how show/hide based on js condition, question in case 2nd condition satisfied, not want hide frame thing, ensure not loaded in background well... think using show/hide not stop loading pdf in background.. question how can acheive using javascript?

**********here trying**********

if(isipad)          {              $('#content').attr('src','ipad_frame.html');          }          else          {              $('#content').attr('src','xyz.pdf');          }  

and in html, have

 <frame src="#" title="content frame" name="content" id="content" /> 

will work fine? reasons, tested , though goes in if/else part, not show relevant content..

why not add elements dynamically in script container element? (assuming you're using jquery):

if(condition) {     $('#container').html('<html frame>'); } else {     $('#container').html('<html pdf>'); } 

this ensure item want load loaded.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -