1

I am currently working in a limited environment (PowerBI) where I can only execute raw HTML/CSS code (no javascript).

Currently I have a page that is loading a very wide image in a container (with scrollbars), and the goal is to set the scrollbar position at a specified point when the page loads.

I have tried to hide elements behind the images and use tags to jump to certain positions but I am unsure if it is possible to execute these links at runtime.

If anyone has any ideas that would be greatly appreciated.

  • 1
    You can give the target element an id, and using the same in URL, you can set the scroll position to the corresponding element – Abin Thaha Sep 21 '21 at 11:23
  • Does this answer your question? [Linking to a specific part of a web page](https://stackoverflow.com/questions/15481911/linking-to-a-specific-part-of-a-web-page) – Ivar Sep 21 '21 at 11:28
  • The problem in this case is that I am executing raw html code (so I am not sure if it is possible to to load the page with any anchors?) – Brett van der Nest Sep 21 '21 at 11:39
  • I've had a certain amount of success in the past with using a meta refresh for such an automatic jump to an anchor, where I could not supply the anchor in the calling URL - ``, to jump to the element with ID `foobar`. That appears to work as well, if the `meta` element is not wrapped into the `head` (which I assume you probably won't be able to specifically insert content into here.) I have no idea whether that will work in "PowerBI" though, since I don't know what kind of rendering engine that uses (or if it even displays the content itself.) – CBroe Sep 21 '21 at 12:20
  • Please provide enough code so others can better understand or reproduce the problem. – Community Sep 28 '21 at 11:25

1 Answers1

0

My immediate thought is to see if you can place a form field with the cursor in. The browser should scroll the cursor into view.

Alternatively, you could try putting an <a name='foo'></a> tag at the point you want the page to view, and to use that URL rather than the page root (i.e. https//foo.bar.com/page.html#foo) - again, the relevant portion of the page should be scrolled into view. (Although changing the load URL might not be an option for you, I know.)

JohnP
  • 1,229
  • 6
  • 24
  • thanks! ill try the cursor idea and see how it works. However, I am passing and running raw code (stored in a table as text) instead of URLs, so im not sure how I could load the page with the given tag. – Brett van der Nest Sep 21 '21 at 11:34