Page 1 of 1

WebGadget question ,Open webpage in same window?

Posted: Fri Jul 25, 2008 10:58 am
by Jimboi
Does anyone know How to make a webpage open in the same window instead of a new one?
see html code below:-

<a href="http://www.quackit.com/travel/new_... target="_blank"> <img src="http://www.quackit.com/pix/milford_... width="225" height="151" alt="Milford Sound in New Zealand" /> </a>

refer to this code,when you click the link,page will open in new window.but i dont want this, i want it open in same window. Any help on this would be great.

Posted: Fri Jul 25, 2008 11:26 am
by Fluid Byte
This is no HTML board ...

Anyway, remove -> target="_blank"

Posted: Fri Jul 25, 2008 2:43 pm
by Rook Zimbabwe
target="_blank :evil:

target="_self :D

Posted: Sat Jul 26, 2008 7:17 am
by Jimboi
iam sorry for unclear Question.what i mean is when i use webGaget to load that html contain code(target=_blank) anytime i click on that link it will open in new window right?..so if possible , i want it open in same webgaget. Maybe sending message to webgaget or something else...
Actually iam very new to purebasic,just found this software and start play with it.maybe that why my question sound weird or something else.

Posted: Sat Jul 26, 2008 2:37 pm
by .:M:.
That's it.
Using Threads for better handling of #PB_Web_Busy.
Remember:
#PB_Web_Busy has problems with some websites (because loading
permanently some ad-stuff, flash...)
You then better get the full code of the website in every loop and search for "</html>" instead of using #PB_Web_Busy.
"</html>" then is the indicator for website is loaded.

Code: Select all

Enumeration
  #window
  #webgadget
EndEnumeration

Global WebGagdetLoad=0

Procedure Manipulate_HTML()
  WebGagdetLoad=0
  html$ = GetGadgetItemText(#webgadget, #PB_Web_HtmlCode)
  html_new$=ReplaceString(html$, "_blank", "_self",#PB_String_NoCase,1)
  SetGadgetItemText(#webgadget, #PB_Web_HtmlCode, html_new$) 
EndProcedure

Procedure WebGadgetBusy(*Val)
  Repeat 
    Delay(10)
  Until GetGadgetAttribute(#webgadget,#PB_Web_Busy)=0
  WebGagdetLoad=1
  Debug "Website loaded. Thread closed"
EndProcedure

OpenWindow(#window, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu)
  CreateGadgetList(WindowID(#window))
  WebGadget(#webgadget, 10, 10, 580, 280, YourURL$)
  html_test$="<a href='http://www.google.com' target='_blank'>google.com</a>" ;HTML for testing "_blank" to "_self"
  SetGadgetItemText(#webgadget, #PB_Web_HtmlCode, html_test$)
thread=CreateThread(@WebGadgetBusy(), 23)
ThreadPriority(thread, 8)
 
Repeat 
If WebGagdetLoad=1
  Manipulate_HTML()
EndIf
Until WaitWindowEvent() = #PB_Event_CloseWindow

Posted: Mon Jul 28, 2008 7:54 am
by Jimboi
Thanks a lot .:M:. u can date my siste.. :)

Posted: Mon Jul 28, 2008 8:31 am
by Fangbeast
Jimboi wrote:Thanks a lot .:M:. u can date my siste.. :)
Does your sister know that you are trying to give her body away to strangers? :twisted: :twisted: :twisted: :twisted: :twisted:

Posted: Mon Jul 28, 2008 11:12 am
by Jimboi
I never had a sister..just try to make .:M:. jumping like a monkey :)