According to the documentation, “Beginning with 2011r2, Show does not take the optional parameter InNewWindow.” What should I do then if I want to open a page in a new window?
Thanks.
According to the documentation, “Beginning with 2011r2, Show does not take the optional parameter InNewWindow.” What should I do then if I want to open a page in a new window?
Thanks.
Most every browser today comes with a popup blocker. So very, very often will your program bump into that and will never be able to show the page.
The only sensible way to obtain what you want is to use a link set to “Open in a new Window”, and point to your program with a hashtag that tells it which webpage to show :
http://127.0.0.1:8080#Page2
And in Session :
Sub Open()
if Hashtag = "Page2" then
WebPage2.show
end if
End Sub
Note that most tabbed browsers will simply open a new tab instead of a new window.
Also, Page2 will be displayed by a new session, not the session where the link was pressed. You need to manage that.
You can use a Webstyle to make the link look like a button.
Sorry that I did not make myself clear, what I actually want is to open a Xojo webpage in a new tab within the same session, not a new window.
Window or tab, that will be a new browser. It automatically creates a new session. Heck, even simply reloading in the same browser does that as well. I did not use the new window parameter back before 2011R2, but it would make sense that it did the same.
What you can do is to send the calling session identifier through the link, so you can refer to it in the new session.
For instance, in the Link Open :
Sub Open()
me.URL = "http://127.0.0.1:8080#Page2&"+session.Identifier
End Sub
In Session.Open :
Sub Open()
If Hashtag <> "" then
dim h() as string = split(HashTag,"&")
if H(0) = "Page2" then
WebPage2.show
end if
end if
End Sub
In WebPage2.Open :
Sub Open()
dim h() as string = split(Session.Hashtag, “&”)
Label1.Text = App.SessionWithIdentifier(h(1)).WebPage1.Textfield1.Text
End Sub
That way the content of TextField1.Text on WebPage1 in the calling session will be displayed in Label1 on Page2 in the other session.
That was what I referred to as “you need to manage that”.
Thanks Michel, I’ll have it a try.
You’re welcome.