Link to anchor in iframe

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Link to anchor in iframe

vwagoner
I'm trying to link to a named anchor in Shadowbox iframe. Not having any success. The box opens blank if I use a link like "page.aspx#namedLocation". If I just use "page.aspx" the page loads in the box but of course not where I would like it to.

Here is my init:

    <script type="text/javascript"> Shadowbox.init({ players: ['iframe','html'], modal: true, overlayColor: "#242D5D", viewportPadding: "5" }); </script>
Any help would be much appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Link to anchor in iframe

vwagoner
If anyone has an answer to this for just using a link like "page.aspx#namedLocation" please reply.

I just wrote some code to respond to a query string as a work around. Shadoxbox doesn't seem to mind a link like "page.aspx?var=something" and I just created a page to redirect to the page I want to show in the box with some code behind in the page load event like:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.QueryString("var") = "something1" Then
            Response.Redirect("page.aspx#namedLocation1")
        ElseIf Request.QueryString("var") = "something2" Then
            Response.Redirect("page.aspx#namedLocation2")
        Else
        End If
    End Sub

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Link to anchor in iframe

Wizzud
In reply to this post by vwagoner
Specify the player in the rel attribute...
rel='shadowbox;player=iframe'
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Link to anchor in iframe

vwagoner
Cool.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Link to anchor in iframe

Marc
In reply to this post by Wizzud
Can you help me? I have an iframe shadowbox that has a link inside it. How can I redirect the page according to the link (terminating the shadowbox)