Open Asp.net MVC View page in a Tab - asp.net-mvc-4

how can i open an asp.net MVC view page in new tab. I have a left panel from where you will redirect to new page and i need to open that page in new tab of existing project not in new window.And also from ExtJS Sencha grid cell click.

Isn't it the anchor attribute target http://www.w3schools.com/tags/tag_a.asp what you are looking for? If yes then look here Opening a link in a new tab for the details how to use it.

You can't to this in a standard way.
Opening pages in new tab or new window, is a browser configurable option, not a programmable manner. So, you haven't any control over it.
However, opening new pages(whether in new tabs or new pages) is achieved in client side by this javascript line:
window.open();
Now, you have two ways in front:
1) You just want to open a new tab/page and request a view. Just set the url in the open() method:
window.open('#Url.Action(...)');
2) You send some data to controller and want to show the results in new tab/page.
First, send an ajax or ordinary post request to the controller and retrieve results in the same view.
Then, open a new tab/page and put that result to it:
var w = window.open();
$(w.document.body).html(content.responseText);

Related

Multiple Windows In ASP.NET Core Blazor

I am learning Blazor from a WinForms background. In Winforms I used to create a new form perhaps on a click of a button to display some info or a map then drag it to a second monitor.Can I achieve the same with a blazor app. I see many tutorials on dialogs but I believe that I am correct in thinking that this is not what I am looking for in that you cant move a dialog to diffrent part of the screen or 2nd monitor?
Blazor is a web app technology, so you can't break out of the context of the tab (or tabs) in the same way that you can with WinForms by opening a new form, even dialogs will remain inside the context of the current tab.
I would suggest the following:
Use JS Interop to open a new tab targeting the component that you want opened separate from the current location
Drag that tab onto another monitor.
#inject IJSRuntime JSRuntime
public async Task OpenInNewTab(string url)
{
await JSRuntime.InvokeAsync<object>("open", url, "_blank");
}

How to handle new tab opening with Splash?

I'm scraping website which has a very annoying link (<a> HTML tag) - it opens the small pop-up form on click and after submitting it, opens new browser tab (and switches focus to it) with URL that I need, and also redirects old tab to another page.
Successful submitting of the pop-up form was easy, but I don't know how to get URL of this new tab.
And as the documentation says, Splash can work only with one tab, so is it impossible to do that?
As Splash's developer comments on this GitHub issue this feature is not implemented.
But I posted my solution to this problem on the same issue.
Example:
function main(splash, args)
assert(splash:go(args.url)) -- execute JS code below only after loading the page
splash:runjs("var newTabURL")
splash:runjs("newTabURL = null") -- sometimes JS can't find variable without this line
splash:runjs("window.open = function(url){newTabURL = url}")
-- actions which open the new tab
local new_tab_url = splash:evaljs("newTabURL")
-- other actions
end

Gecko:Login to website

I am new to web browser control geckoFx. I want to login to a webpage using it. So how can i do it in vb.net
I tried navigating to the webpage using navigate method.
InitializeComponent()
Xpcom.Initialize("D:\xulrunner")
myBrowser = New GeckoWebBrowser()
myBrowser.Parent = Me
myBrowser.Dock = DockStyle.Fill
myBrowser.Navigate("www.google.com")
But how can i login to website?
I tried searching for few examples of using gecko.But i didn't get. So where i can get examples related to using gecko?
There are a number of different ways to do this. After you have navigate to the page and it has finished loading:
execute some javascript to fill in the fields and click the submit button.
C# javascript execute examples
use C# (or vb.net) to get the required DOM fields, modify them with the required values, then get the DOM submit button and call the click api.
Examples of GetElementById
GeckoInputElement class that has a click method

How to change the url of my entire page when a new tab is selected? (Dojo-Tabcontainer)

I have used Dojo-Tabcontainer to create tabs. I want to have a separate template for every tab. So, when a tab is clicked I want a new page to be loaded and the url to be changed.
Can you please suggest a way to do this using Markup instead of programmatic way?
I'm thinking of using Template Inheritance while creating html page for each tab to avoid redundancy.
I can get some clue from this:
How to change Dojo TabContainer behaviour to simply open an external link instead of showing a ContentPane?
But I'm not sure how to do it via Markup instead of programming.

Chrome extensions: How can I pass form variables to a url in a newly created tab?

I'm working on my first chrome extension, and using an image-based context menu item to capture the URL of a given image, and want to then display that image at a specific URL in a new tab. So, I need to pass the URL of the image clicked on (using srcUrl) to a specific script that can then render it on that page. Is it possible to perform an HMLHttpRequest from within a chrome.tabs.create() call, or must this be done some other way?
Thanks for any help.
You would need to create an HTML page containing that script and put it into your extension folder. Then you can just pass image url to it as GET parameter:
chrome.tabs.create({url: "local.html?img_url=...");
If url parameter is not enough, you would be also able to communicate with that page using chrome.tabs.sendRequest():
chrome.tabs.create({url: "local.html", function(tab){
chrome.tabs.sendRequest(tab.id, {img_url: "local.html?img_url=...");
));
With the request listener in that page:
chrome.extension.onRequest.addListener(function(request) {
console.log(request.img_url);
});