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.
			
			
									
									
						WebGadget question ,Open webpage in same window?
- Fluid Byte
 - Addict

 - Posts: 2336
 - Joined: Fri Jul 21, 2006 4:41 am
 - Location: Berlin, Germany
 
This is no HTML board ...
Anyway, remove -> target="_blank"
			
			
									
									Anyway, remove -> target="_blank"
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
						- Rook Zimbabwe
 - Addict

 - Posts: 4322
 - Joined: Tue Jan 02, 2007 8:16 pm
 - Location: Cypress TX
 - Contact:
 
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.
			
			
									
									
						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.
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.
			
			
									
									
						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


