javascript - Why doesn't setting frame src by js show the display source? -
based on js condition, want either of 2 things happen;
- either show frame on page or
- 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
Post a Comment