javascript - scribd set page not working -
i using scribd display pdf. clicking on page 3,middle,end links corresponding pages should load. pages not loading properly. , in ff not getting errors. in chrome console getting error. failed execute 'postmessage' on 'domwindow': target origin provided ('http://www.scribd.com') not match recipient window's origin ('https://www.scribd.com'). can me out in this?
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>scribd javascript api demo</title> <script type="text/javascript" src='https://www.scribd.com/javascripts/scribd_api.js'></script> </head> <body> <div id="container"> <div id='col1'> <div id='embedded_doc'><a href='https://www.scribd.com'>scribd</a></div> </div> <div id='col2'> <h2 id="header"> loading document... </h2><br/> <span id="author"></span> <div id="bookmarks"> <h4>bookmarks</h4> <ul> <li><a href="javascript:gotopage(3);">page 3</a></li> <li><a href="javascript:gotomiddle();">middle</a></li> <li><a href="javascript:gotoend();">end</a></li> </ul> </div> <div id="comment"></div> </div> <div class="clearfix"> </div> </div> <script type="text/javascript"> // data // instantiate ipaper var scribd_doc = scribd.document.getdoc(2520449, 'key-1127428tb3rbejns9bhr'); // parameters scribd_doc.addparam('height', 420); scribd_doc.addparam('width', 530); scribd_doc.addparam('auto_size', true); scribd_doc.addparam('mode', 'slideshow'); scribd_doc.addparam('jsapi_version', 2); // write instance scribd_doc.write('embedded_doc'); // bookmark helpers var gotopage = function(page) { alert(scribd_doc.api.getpagecount()); if (scribd_doc.api){ scribd_doc.api.setpage(3); } } var gotomiddle = function() { if (scribd_doc.api){ gotopage( math.floor(scribd_doc.api.getpagecount()/2) ); } } var gotoend = function() { if (scribd_doc.api) { gotopage(scribd_doc.api.getpagecount()); } } </script> view source , you'll see dynamically generated using scribd javascript api. </body> </html>
i fixed issue downloaded scribd_api.js file , modified path https in js. , set page working without errors.
Comments
Post a Comment