jrp Posted September 15, 2021 Share Posted September 15, 2021 Hello, How to view a PDF file in a new browser tab? Thanks Quote Link to comment Share on other sites More sharing options...
jrp Posted September 16, 2021 Author Share Posted September 16, 2021 I mean: I have the URL of a PDF file. When a button clicked, I want to display that URL in a new browser tab (not a new browser window). Quote Link to comment Share on other sites More sharing options...
irigsoft Posted September 16, 2021 Share Posted September 16, 2021 7 hours ago, jrp said: I mean: I have the URL of a PDF file. When a button clicked, I want to display that URL in a new browser tab (not a new browser window). UniSession.AddJS('var myWindow = window.open(''' + YourFullPathToFile_FileName {OR URL} + ''', ''foo'','''');'//+ ''', ''_blank'');' + ' if (myWindow == null)' + ' alert (''Please change your popup settings'');' + ' else {' + ' myWindow.moveTo(0, 0);' + ' myWindow.resizeTo(screen.width, screen.height);' + '}' //+ 'myWindow.print();' //+ 'myWindow.close();' ); 1 Quote Link to comment Share on other sites More sharing options...
jrp Posted September 16, 2021 Author Share Posted September 16, 2021 Hello irigsoft, It took me some time to understand your code, but finally I made it 😁 This is the actual code I use: UniSession.AddJS('var myWindow = window.open(''' +FileURL+ ''', ''_blank'');' + ' if (myWindow == null)' + ' alert (''Please change your popup settings'');' + ' else {' + ' myWindow.moveTo(0, 0);' + ' myWindow.resizeTo(screen.width, screen.height);' + '}'); Thank you irigsoft. I don't know JavaScript at all. I think this should be considered a basic functionality, and should be provided by UniGUI, so we don't need to touch any JavaScript. Maybe we should have something like UniSession.OpenUrl(AUrl: string; NewTab: boolean); 2 Quote Link to comment Share on other sites More sharing options...
irigsoft Posted September 16, 2021 Share Posted September 16, 2021 1 hour ago, jrp said: I think this should be considered a basic functionality, Thank You, In the beginning I needed help too - and I still don't know javascript, but here is a programming language that will be used in the future (and it's useful to know) Master Delphi - as a base uniGui - to group all this. UniGui is a very good choice Quote Link to comment Share on other sites More sharing options...
bgxbd Posted March 1, 2022 Share Posted March 1, 2022 On 9/17/2021 at 12:55 AM, irigsoft said: Thank You, In the beginning I needed help too - and I still don't know javascript, but here is a programming language that will be used in the future (and it's useful to know) Master Delphi - as a base uniGui - to group all this. UniGui is a very good choice Hello irigsoft , Jrp How to change the title of a new browser tab when it is opened ? The title is the same as the stored file on the server, but it is not the original file name( When uploading the file, I changed the original file name ). I want the title to be the original filename, also when downloading and saving. Best Regards Quote Link to comment Share on other sites More sharing options...
irigsoft Posted March 1, 2022 Share Posted March 1, 2022 1 hour ago, bgxbd said: Hello irigsoft , Jrp How to change the title of a new browser tab when it is opened ? The title is the same as the stored file on the server, but it is not the original file name( When uploading the file, I changed the original file name ). I want the title to be the original filename, also when downloading and saving. Best Regards maybe this will help: https://stackoverflow.com/questions/8051811/how-to-show-window-title-using-window-open https://social.msdn.microsoft.com/Forums/en-US/b77d5197-c7cc-447d-8a04-86495e40188d/how-to-give-window-title-in-windowopen-javascript-method?forum=aspgettingstarted Quote Link to comment Share on other sites More sharing options...
bgxbd Posted March 2, 2022 Share Posted March 2, 2022 On 3/1/2022 at 3:01 PM, irigsoft said: maybe this will help: https://stackoverflow.com/questions/8051811/how-to-show-window-title-using-window-open https://social.msdn.microsoft.com/Forums/en-US/b77d5197-c7cc-447d-8a04-86495e40188d/how-to-give-window-title-in-windowopen-javascript-method?forum=aspgettingstarted var myWindow = window.open('', '', 'width=600,height=400'); setTimeout(function(){ myWindow.document.title = 'my new title'; }, 1000); Thanks very much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.