none
passing page url parameter to iframe url

    Question

  • I'm looking to make adjustments to a PublishingLayoutPage with an embedded iFrame that we use to point to a third party career site. They now need to have a variable that will be passed from our careersearch page’s url to the iFrame’s url so that they can be told on their end to drill to a particular job. Basically, if an applicant goes to Monster.com and clicks on one of our delivery driver jobs, it should open our careers site’s job search page, but drilled to that job item rather than the default job search form that would normally display.

    I’d thought something like this would handle it but I keep blowing the page up. It tells me code blocks are not allowed in content pages. Is there a tag or wrapper I’m missing to allow me to place script in a content layout page?

     

    <script> 
     
    <% string JobPost;  
     
      foreach ( string PostID in Request.QueryString ) {  
     
         If ( Request.QueryString[ PostID ] != "" ) JobPost = Request.QueryString[ PostID ];  
     
         else JobPost = "&nbsp;"; %> 
     
    </script> 
     
       
     
    <iframe frameBorder="0" width="530" height="700" src="https://www.domainname/careers/jobsearch.aspx?JobItem=<%= JobPost %>"></iframe> 
     
    Tuesday, December 02, 2008 6:05 PM

Answers

  •  I was trying to make it harder than it needed to be... Did some hunting and found this Getting Query String Parameters with JavaScript in SharePoint

    <script type='text/JavaScript'>  
    <!--  
    //First call the EnsureSetup method  
    JSRequest.EnsureSetup();   
     
    //Get a query string parameter   
    if (JSRequest.QueryString["JobID"] == null || JSRequest.QueryString["JobID"] == "")  
    {itemID = "default";  
    }  
    else 
    {itemID = JSRequest.QueryString["JobID"];  
    }  
     
    document.write('<iframe frameBorder="0" width="530" height="700" src="http://domain.com/?JobID=' + itemID + '"></iframe>')  
    //--></script>  
     
    • Marked as answer by CorumMc Sunday, December 07, 2008 4:45 AM
    Sunday, December 07, 2008 4:45 AM