WebGadget question ,Open webpage in same window?

Just starting out? Need help? Post your questions and find answers here.
Jimboi
User
User
Posts: 19
Joined: Fri Jul 25, 2008 10:41 am
Location: Malaysia

WebGadget question ,Open webpage in same window?

Post 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.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

This is no HTML board ...

Anyway, remove -> target="_blank"
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

target="_blank :evil:

target="_self :D
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Jimboi
User
User
Posts: 19
Joined: Fri Jul 25, 2008 10:41 am
Location: Malaysia

Post 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.
.:M:.
New User
New User
Posts: 7
Joined: Sun Jul 20, 2008 7:34 am

Post 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
Jimboi
User
User
Posts: 19
Joined: Fri Jul 25, 2008 10:41 am
Location: Malaysia

Post by Jimboi »

Thanks a lot .:M:. u can date my siste.. :)
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4792
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post 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:
Jimboi
User
User
Posts: 19
Joined: Fri Jul 25, 2008 10:41 am
Location: Malaysia

Post by Jimboi »

I never had a sister..just try to make .:M:. jumping like a monkey :)
Post Reply