sharepoint - Javascript: Extract part of URL, clean it, and use it within html embed code for a flash container -


sorry in advance, lots of answers on site relate parts of query, though failing connect dots. appreciated (happy buy virtual beers, etc)

i'm looking take url, , extract part of string left of "&folderctid", , right of "rootfolder=", e.g:

this: http://mysite.com/project1/forms/allitems.aspx?rootfolder=%2fproject1%2flesson%2014&folderctid=0x01200075c0e8ac5a64724787732a3200049d3a&view={440f5454-054d-4c68-a1e2-4a52e4fd8fcb}

becomes: %2fproject1%2flesson%2014

i looking replace "%2f" "/", , add trailing "/presentation.swf", leaving me file reference - "/project1/lesson%2014/presentation.swf"

finally, i'd use file reference within embed code, e.g. src=&quot/project1/lesson%2014/presentation.swf&quot

is possibe?

this works me

theurl='http://mysite.com/project1/forms/allitems.aspx?rootfolder=%2fproject1%2flesson%2014&folderctid=0x01200075c0e8ac5a64724787732a3200049d3a&view={440f5454-054d-4c68-a1e2-4a52e4fd8fcb}';  filepath = theurl.match(/rootfolder\=(.*?)&/)[1].replace(/%2f/g, "/")+"/presentation.swf";  alert(filepath); 

i don't think need decode url use in src use

filepath = theurl.match(/rootfolder\=(.*?)&/)[1]+"%2fpresentation.swf"; 

try swfobject https://code.google.com/p/swfobject/wiki/documentation

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">   <head>     <title>swfobject dynamic embed - step 3</title>     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />     <script type="text/javascript" src="swfobject.js"></script>      <script type="text/javascript">     swfobject.embedswf(filepath, "mycontent", "300", "120", "9.0.0");     </script>    </head>   <body>     <div id="mycontent">       <p>alternative content</p>     </div>   </body> </html> 

or if using jquery can try http://jquery.lukelutman.com/plugins/flash/

$(document).ready(function(){     $('#example').flash(         { src: filepath,           width: 720,           height: 480 },         { version: 8 }     ); });  <div id="example">you don't have flash</div> 

or http://jquery.thewikies.com/swfobject/

$(document).ready(     function() {         $('#myflash').flash(filepath);     } );  <div id="myflash">you don't have flash</div> 

i have included filepath variable in right place in above examples


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -