简体   繁体   中英

How can I open a new window using location.href but with vbscript

I have a very old app that the scripting language is Vbscript, I nned to open a new window with location.href. How can I do that? is it possible?

Assuming it's using VBScript as an alternative to JavaScript for client-side scripting then the DOM API is identical.

That said, you don't use window.location to open a new window, you use it to change the location of the current window.

You open a popup window with window.open . In VBScript I believe it's Window.Open (note the casing, but VBScript is case-insensitive so it shouldn't matter):

Sub OpenNewWindow

    Window.Open "http://somewhere", "_blank"
End Sub
  • VBScript doesn't have parentheses for Sub ( void ) method calls as there is no return value.
  • VBScript only uses double-quotes ( " ) to delimit strings

You can't. The location object supplied by browsers is for accessing the location of the current window.

If you want to create a new window, you have to use the open() function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM